MCPcopy Index your code
hub / github.com/php/frankenphp / validate

Method validate

context.go:135–154  ·  view source on GitHub ↗

validate checks if the request should be outright rejected

()

Source from the content-addressed store, hash-verified

133
134// validate checks if the request should be outright rejected
135func (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
156func (fc *frankenPHPContext) clientHasClosed() bool {
157 if fc.request == nil {

Callers 1

ServeHTTPFunction · 0.80

Calls 2

rejectMethod · 0.95
GetMethod · 0.80

Tested by

no test coverage detected