Closed Bug 1455447 Opened 6 years ago Closed 6 years ago

multipart/form-data content is not sent of page reload

Categories

(Core :: Networking: HTTP, defect)

59 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1434553

People

(Reporter: micnic90, Unassigned)

References

Details

(Keywords: regression, regressionwindow-wanted)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0
Build ID: 20180323154952

Steps to reproduce:

1. Take a page with a form that sends data to the server, something similar to the following:
    <form action="/" method="post" enctype="multipart/form-data">
        <input type="file" name="file">
        <input type="submit" value="Submit">
    </form>

2. Submit it to the server, the server should not redirect to any other page
3. When the location is loaded press "Page Refresh" (F5)
4. The browser should ask in a dialog for confirming to send again the form, press "Resend"


Actual results:

The browser is sending only the headers of the input but not the content to the server when pressing the "Resend" button, even if in the developer tools, in Network panel it's fine. The data sent looks something like this:

-----------------------------191428588219503030671700742908\r\n
Content-Disposition: form-data; name="file"; filename="file.js"\r\n
Content-Type: application/x-javascript\r\n
\r\n
(END, NO CONTENT)


Expected results:

The browser should resend the full content of the provided file, not only it's headers.
Component: Untriaged → HTML: Form Submission
Product: Firefox → Core
Can't reproduce using
data:text/html;charset=utf-8,<form action="http://software.hixie.ch/utilities/cgi/test-tools/echo" method="post" enctype="multipart/form-data"><input type="file" name="file"><input type="submit" value="Submit"></form>

Reporter, is there a publicly-accessible demo of the problem?
Flags: needinfo?(micnic90)
It is reproducible using the example that you provided.
I made a video for showing the issue, it is available from here: https://drive.google.com/open?id=184Jy-SrB7MCyREe1XWRAlvP-tEvFnQEU

In the video, I created a file "test.txt" with the content "TEST CONTENT", when uploading the first time the file the content length of the data is 226 bytes, after refresh it weights 152 bytes.

I tested this behavior also in Ubuntu 16.04, it's broken there in the same way.
Flags: needinfo?(micnic90)
I can confirm, using the steps to reproduce from comment 0 and the URL from comment 1.

In both cases (first submission and post reload) the full request body gets sent, however the second time the Content-Length header is wrong.  The file that I tested was 495 bytes, but the second time, the Content-Length header was set to 179.  This feels more like a Necko bug, moving to the right component to get it prioritized there.

I also used mozregression to test an old build from 2016-01-01, and this used to work back then.  Marking as regressionwindow-wanted.
Component: HTML: Form Submission → Networking: HTTP
Status: UNCONFIRMED → NEW
Ever confirmed: true
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.