Bug 188586 - [Cocoa] HEAD request should behave as same as GET request for Content-Length header.
Summary: [Cocoa] HEAD request should behave as same as GET request for Content-Length ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-14 16:07 PDT by Basuke Suzuki
Modified: 2020-05-18 00:02 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2018-08-14 16:07:08 PDT
In the http/tests/xmlhttprequest/methods.html test, 

GET request doesn't send Content-Length field. The test log of 'GET(null bytes)' indicates no Content-Length header is sent.

> GET(""): GET(null bytes), Content-Type: null
> GET(null): GET(null bytes), Content-Type: null
> GET("123"): GET(null bytes), Content-Type: null

But http/tests/xmlhttprequest/methods-expected.txt, HEAD seems sending Content-Length header with value of 0.

> HEAD(""): HEAD(0 bytes), Content-Type: null
> HEAD(null): HEAD(0 bytes), Content-Type: null
> HEAD("123"): HEAD(0 bytes), Content-Type: null

As specification defined, HEAD should be as close identical as GET request.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
"The HTTP HEAD method requests the headers that are returned if the specified resource would be requested with an HTTP GET method"

Soup and Curl returns (null bytes) which is same with GET requests.
Comment 1 Rob Buis 2020-05-17 23:36:58 PDT
It would be nice to have HEAD behave as GET here, in order to pass more WPT tests and align with other platforms (like gtk). However this seems like CFNetwork behavior and maybe not necessarily a WebKit bug?
Comment 2 youenn fablet 2020-05-18 00:02:08 PDT
<rdar://problem/56144949>