Closed Bug 96121 Opened 25 years ago Closed 24 years ago

POST not sending Authentication header

Categories

(Core :: Networking: HTTP, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED INVALID
mozilla0.9.7

People

(Reporter: dan, Assigned: darin.moz)

References

Details

(Keywords: perf, testcase)

Attachments

(9 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3+) Gecko/20010815 BuildID: 2001081514 If I try to submit a form that uses a POST to a web site using basic authentication, the Authentication header is not present. It is present in Netscape 6.0 and is not present in Netscape 6.1 or any recent version of Mozilla that I have tried. Reproducible: Always Steps to Reproduce: 1.connect to a site with basic authentication 2.submit a form with a POST 3.headers do not have Authentication: in them. Actual Results: Page times out even though the server sent back a 401 Unauthorized error Expected Results: it should have sent the Authentication header or prompted me for authentication or something other than just timing out. This appears to be a problem on all platforms, Linux, Windows 2000 etc. Tried with Tomcat and Netscape-Enterprise/4.1 as server. Same problem except that with tomcat the bowser waits forever.
A further observation: it occurred to me that this could, in some sense, be a mod_jk issue, perhaps mod_cgi had some means of gluing together the two parts of the request. In fact it does not, a simple CGI script (which copies stdin to stdout) leads to the same Mozilla-is-waiting behaviour, whilst Netscape 6 and IE5 both succeed, specifically by presenting the Authorisation: header in the first place.
Reporter, can you try again with latest Mozilla nightly build and report if problem still occurs. Build available here: http://ftp.mozilla.org/pub/mozilla/nightly/latest/mozilla-i686-pc-linux-gnu-sea.tar.gz I say so because I just dealt with Post+Authentication yesterday with Mozilla and it worked fine. Here's a testcase: http://www.epita.fr:8000/~cahagn_o/mozbug/96121/
Keywords: testcase
I forgot to mention login/password for above testcase: login: mozilla password: mozilla
About a month ago the builds I tried suddenly started to work. I tried today with the latest build and it too works just fine. However it appears to POST the form, get a response saying that I am not authorized, then mozilla responds with the proper POST with the Authentication included. This works ok, however when uploading a large file etc. it POSTS the file twice. I am not sure if that is how it is supposed to work or not, but netscape 4.7 only does the POST once with Authentication in the header the first time.
Adding perf keyword per that last comment. This is not a good thing... :)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: perf
darin
Assignee: neeti → darin
dan: are you sure about your findings with 4x? it seems like it should also have to "blindly" POST and then rePOST with an Authorization header. perhaps 4x had already stored the Authorization value from a previous attempt?
If I understand the last comment correctly, yes, netscape 4 was already authenticated to the web site (via the page with the form on it) and then was asked to post a file back to that web site. Thus it already knew the authentication information necessary and passed it along with the POST.
mozilla should behave similarly.. are you saying that it doesn't?
I just tried to upload a file to a password protected form and Mozilla 0.9.6 gets this in return: HTTP/1.1 401 Unauthorized Server: Netscape-Enterprise/4.1 Date: Mon, 26 Nov 2001 20:35:20 GMT WWW-authenticate: Basic realm="doesnt matter" Content-type: text/html Connection: close And then Mozilla shows a page saying "Request Timeout" The server timed out waiting for the client request. It does not even appear to try to authenticate. This is the same behavior I saw with Mozilla 0.9.3. It was working in 0.9.4. Now 0.9.6 does not try to authenticate and re-send the form at all. Netscape 4.x seems to know that the page it is sending the POST to needs authentication and sends the Authentication header automatically on the first attempt. Mozilla 0.9.4 tried to send it, realized it needed authentication, and then re-submitted the form.
investigating for 0.9.7
Priority: -- → P2
Target Milestone: --- → mozilla0.9.7
Blocks: 110705
Darin I will take this one. Roland, Can i get access to the site that causes this problem ? Else can start up ur browser and provide me with a trace of all interaction between browser and server. In the traces u have provided I do not see the first authentication succeeding.
reporter: after the landing for bug 15860 (support for digest auth) some areas relating to basic auth were touched, so mozilla's behavior w.r.t. this bug may have changed. can you please d/l a new nightly build and verify the problem you reported? thx!
I downloaded and tried the nightly build from the 4th (Gecko/20011204) and now it is back to the state it was in for build 0.9.4. I can upload content to the server but there is a performance problem. It first uploads the file and all the other form elements but the header does not contain the Authorization. It gets a 401 Unauthorized, then resends the entire form and uploads the file again, but this time with the proper Authorization header. I'll see if I can create an attachment to this with the trace.
This is a sniffer trace starting with the first contact of the server, entering name and password, navigating to the right page and filling out a form. You can see that the file gets uploaded to the server twice.
strange... cuz in both cases the directory portion of the URL is '/' so the authentication cache should have been able to supply auth credentials for the first POST request. i know this works for GET requests... so there must be something different in the POST code path.
Is there any difference in the way normal posts and multi-part posts are handled ?
not as far as the http module is concerned. however, multipart POSTs use a file stream, whereas url-encoded POSTs use a memory stream. see content/html/content/src/nsFormSubmitter.cpp
I have created a tar of the needed files
I am unable to reproduce the bug. I have attached the files I had used for testing and the testcases as well. The trace for interaction between server and client have been included as well. Please indicate if I have missed any detail. Can you please indicate the site you used where the bug was reproducable. Attaching the files and trace in the zip format.
Reporter, Is your site accessible from the internet ? would be easiest to debug against it.
You can use the following URL for testing. Log in as dan@kvsys.com with a password of dan123 and then click on the icon near the middle of the page called "Create Document" That will bring up another window where you can select a file to upload to the server. http://ptcprojectlink.ptc.com/ProjectLink/netmarkets/jsp/project/view.jsp?oid=project%7Ewt.projmgmt.admin.Project2%3A1595467
Thanks, will look into it today.
This bug is invalid. This sort of behaviour can happen under the following circumstance and is the correct behaviour. Assume the following document structure. /docs/doc1/doc2/doc3/a.html /docs/doc1/doc2/doc3/b.html /docs/doc1/doc2/z.html Assume that the server has an ACL that protects /docs/doc1/doc2/. Assume that we first access /docs/doc1/doc2/doc3/a.html. We would get prompted a <u,p> which then gets cached in the client with the keys being <host:port, realm> and the data being <path, <u,p>>. Note that the path stored would be /docs/doc1/doc2/doc3/. If we then access /docs/doc1/doc2/doc3/b.html, the client would send the Authorization header since the path is in the cache is a prefix of the current path. However, if were to access /docs/doc1/doc2/z.html, the client would not send the Authorization header since /docs/doc1/doc2/ is not a prefix of /docs/doc1/doc2/doc3/. Hence this would result in a 401 with the realm being the same as that of the originally ached request. So the client would replay the request with the cached <u,p>. This is expected behaviour.
Attaching a trace of request/response to validate the behaviour seen
Reporter, if u agree, please close the bug as invalid.
I guess I have to agree. However that is not how Netscape 4.x seems to behave. I have not tried any other browsers to see what they do in this circumstance. I suppose as long as the browser does send Authorization automatically upon recieving the 401 (Unlike some of the previous builds), then I can close this bug.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
4x should behave the same way... that is, it should follow the same rules Vinay outlined in comment #28. if there is any difference between mozilla and 4x on this bug, then i suspect very strongly that there is a real mozilla bug here. Reporter, Vinay: can you confirm that 4x behaves identically to mozilla in this case?
I have tested with Netscape Communicator 4.76 using the same test case as metioned in the comment #28 and the behaviour is found to be same as in case of mozilla. I am attaching the trace of browser interaction for the testcase.
It would be better if the browser remembered which pages it got a 401 so that each time the users goes to z.html (see comment #28) it does not need 2 requests to get the job done. Netscape 4.78 doesn't behave the same way, it either does the above or makes different assumptions on when to pass the auth header. In fact, it seems to behave like IE.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: