HEAD request return contents that was cached from a previous GET request
Categories
(Core :: Networking: HTTP, defect, P2)
Tracking
()
People
(Reporter: dima, Assigned: kershaw)
Details
(Whiteboard: [necko-triaged])
Attachments
(2 files, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
According to the docs, HEAD requests should not have a body, and if the server does return a body, it must be ignored: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD
However, Firefox will incorrectly return a response body for a HEAD request if the contents of the URL has been cached from a prior GET request.
I'm attaching a test case; you can also access it at https://dimaryaz.s3.amazonaws.com/head.html
Open the console, then click "HEAD", "GET", "HEAD". The first HEAD will work correctly, while the second one will return a body.
Actual results:
HEAD returns contents
Expected results:
HEAD should not return contents
Reporter | ||
Comment 1•5 years ago
|
||
Real-life example of where this comes up: AWS SDK's "headObject" method tries to parse the response body as XML and fails (unless the file actually contains XML, which is usually not the case). Not sure why it's trying to parse it as XML - but it works fine when there is no response body.
Comment 2•5 years ago
|
||
Reproduced comment 0 on 68.0a1 20190418221600, 67.0b11 20190415085659, 66.0.3 20190409155332 using Ubuntu 16.04/x64.
Reporter | ||
Comment 3•5 years ago
|
||
Fix the DOCTYPE - not sure what happened there.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
According to the spec, we should ignore the response body for the HEAD and CONNECT requests.
Comment 5•5 years ago
|
||
This should land early for 69, IMO.
Pushed by kjang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0427669077f6 Ignore response body if method is HEAD or CONNECT r=mayhemer
Comment 7•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Updated•5 years ago
|
Comment 8•5 years ago
|
||
Hi, I managed to reproduce this issue in older versions of Firefox but this issue no longer occurs in Nightly 69.0a1 (2019-05-29).
Reporter | ||
Comment 9•5 years ago
|
||
Works for me in the nightly builds. Thanks everyone!
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Since this is a Wont fix in other versions I will updated the flags.
Description
•