Skip to content

Commit 9524d31

Browse files
committed
Allow harmless 'Content-Type' headers on requests
1 parent a3606d6 commit 9524d31

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

GCDWebServer/Core/GCDWebServerRequest.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ - (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDict
186186
if (lengthHeader) {
187187
NSInteger length = [lengthHeader integerValue];
188188
if (_chunked || (length < 0)) {
189+
GWS_LOG_WARNING(@"Invalid 'Content-Length' header '%@' for '%@' request on \"%@\"", lengthHeader, _method, _url);
189190
GWS_DNOT_REACHED();
190191
return nil;
191192
}
@@ -200,8 +201,8 @@ - (instancetype)initWithMethod:(NSString*)method url:(NSURL*)url headers:(NSDict
200201
_length = NSUIntegerMax;
201202
} else {
202203
if (_type) {
203-
GWS_DNOT_REACHED();
204-
return nil;
204+
GWS_LOG_WARNING(@"Ignoring 'Content-Type' header for '%@' request on \"%@\"", _method, _url);
205+
_type = nil; // Content-Type without Content-Length or chunked-encoding doesn't make sense
205206
}
206207
_length = NSUIntegerMax;
207208
}

0 commit comments

Comments
 (0)