validate checks if the request should be outright rejected
()
| 133 | |
| 134 | // validate checks if the request should be outright rejected |
| 135 | func (fc *frankenPHPContext) validate() error { |
| 136 | if strings.Contains(fc.request.URL.Path, "\x00") { |
| 137 | fc.reject(ErrInvalidRequestPath) |
| 138 | |
| 139 | return ErrInvalidRequestPath |
| 140 | } |
| 141 | |
| 142 | contentLengthStr := fc.request.Header.Get("Content-Length") |
| 143 | if contentLengthStr != "" { |
| 144 | if contentLength, err := strconv.Atoi(contentLengthStr); err != nil || contentLength < 0 { |
| 145 | e := fmt.Errorf("%w: %q", ErrInvalidContentLengthHeader, contentLengthStr) |
| 146 | |
| 147 | fc.reject(e) |
| 148 | |
| 149 | return e |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | func (fc *frankenPHPContext) clientHasClosed() bool { |
| 157 | if fc.request == nil { |