Closed Bug 82050 Opened 24 years ago Closed 24 years ago

XMLHttpRequest send() must ignore argument if open() method is GET

Categories

(Core :: XML, defect)

defect
Not set
major

Tracking

()

VERIFIED FIXED
mozilla0.9.1

People

(Reporter: hjtoi-bugzilla, Assigned: hjtoi-bugzilla)

References

()

Details

(Keywords: helpwanted, regression)

Any request to load data from a server is answered with either 403 Forbidden or 405 Method Not Allowed The former error is returned when the script tried to POST to a script in cgi-bin directory, and the latter when the script tried to GET an XML file in the normal HTML document area on the webserver. I have not made any changes to the XML Extras component in this time. Others have modied XMLExtras in this time, but I do not see anything in there that could have caused this (it is still possible). There have been lots of changes in necko, though, and xpcdom has landed (though at least initially after the landing XMLHttpRequest did work). Things are even worse in embedding land. The testcase in URL at least pops up alert boxes in Browser, but winEmbed and mfcEmbed do not do that. Alerts work in embedding, though. This could be a separate bug. I checked with pollmann what the webserver is actually seeing, and it looks like we might be giving the server a wrong request. Here is what the server saw last Wednesday when I tried to do "GET http://blueviper/heikki/tupshin4.xml": Client1> POST /tupshin4.xml HTTP/1.1 Client1> Host: heikki Client1> User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9+) Gecko/20 010514 Client1> Accept: */* Client1> Accept-Language: en Client1> Accept-Encoding: gzip,deflate,compress,identity Client1> Accept-Charset: ISO-8859-1, utf-8; q=0.667, *; q=0.667 Client1> Keep-Alive: 300 Client1> Connection: keep-alive Client1> Content-type: text/xml Client1> Content-Length: 13 Client1> Client1> <test></test>ServerClient1> HTTP/1.1 404 Not Found
I can not be 100% certain about the validity of experiment I did with pollmann, but something fishy is going on somewhere. Maybe necko changed subtly but XMLHttpRequest was not changed along with that. Or maybe some recent xpcdom fix did XMLHttpRequest in. My first guess is necko changes, Cc:ng darin, gagan and dougt. I have marked this blocking bug 73958 which I am 75% sure is some kind of off by one error in some stream implementation (cache stream bad?) or some other weirdness. This bug, bug 73958 and maybe bug 82032 are the ones we would need for 0.9.1. You could argue that I should mark all XMLHttpRequest bugs depending on this, but I feel lazy... Tomorrow I'll start downloading nightly builds to see when things broke exactly.
Blocks: 73958, 82032
Target Milestone: --- → mozilla0.9.1
the http re-arch branch landed friday, 5/11... and, this may be a regression due to that. you might try using a packet tracing tool like ngrep to capture activity on port 80 with today's build as well as an older build that works. if you could attach these logs to this bug report i might be able to help diagnose the problem (if it happens to be with necko).
(CCing) A nice Windows tool is: http://www.pocketsoap.com/tcptrace/default.asp
Hmm.. it seems part of this was due to the test server configuration changing. Using the browser the normal post.html and syncpost.html tests work. GET does not work (the testcase in bug 73958). Using winEmbed async does not work, but sync does. The world turned upside down. Sync should not work in embedding 'cos there is no implementation for it! Or so I thought until recently...
The GET method, and what is blocking testing of bug 73958 broke between builds 051104 and 051208 (the former works, the latter doesn't). This bonsai query shows the checkins between 051102 (assuming 2 hours for pull and build) and 051208: http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=SeaMonkeyAll&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Change+Size&hours=2&date=explicit&mindate=05%2F11%2F2001+02%3A00%3A00&maxdate=05%2F12%2F2001+08%3A00%3A00&cvsroot=%2Fcvsroot There are lots of checkins, but the most suspicuous one is HTTP branch landing in my opinion. Changes in xmlextras directory are limited to HTTP header handling (which kinda points in the direction of this bug also). I have also noticed something weird going on with the testcase for bug 73958. When I open tupshin.xul document mork (history database?) seems to get corruped. Maybe that happens because of the wrong headers, no sure... I still haven't found out what is going on with the embedded builds, the nightly builds I have tested all had winEmbed working strange. I should probably open a new bug on that...
Ok, so we actually are not touching the changed header code in xmlextras (placed breakpoints there). But I did notice this line being commented out: ! //mChannel->SetAuthTriedWithPrehost(authp); and what we are getting in 405 Method Not Allowed from the server (POST method even though we asked GET). Maybe that line has nothing to do with it... Let's see if we can come up with ngrep output...
I talked to vidur about that line back when I was making the http changes. Turns out it isn't needed... it basically just says that an authentication dialog should always be displayed even if the URL contains a user:pass already. I don't see how this could have anything to do with the problem described here. The request method will become POST if you set an upload stream on nsIHttpChannel. Is this happening?
Allright, I have at least a workaround. Now it kinda even makes sense why the tescase failed, but I don't know why it worked before the HTTP landing. Maybe necko did not change the method? Should I close this bug as INVALID (wrong usage pattern)? If wrong usage, I guess I might need to throw an error in the send method to inform the developer that what they are trying to do does not make sense... The testcase was doing [XMLHttpRequest object].open("GET","http://green/heikki/tupshin4.xml"); [XMLHttpRequest object].send([dummy XML DOM document]); So this kinda looks like we are trying to do a GET but sending a serialized dummy XML document to the server at the same time. The workaround is changing the second line to: [XMLHttpRequest object].send(null); Before the HTML landing things still somehow worked. This is ngrep output: T 208.12.36.155:4354 -> 208.12.36.110:80 [AP] GET /heikki/tupshin4.xml HTTP/1.1..Host: green..User-Agent: Mozilla/5.0 (Wi ndows; U; WinNT4.0; en-US; rv:0.9+) Gecko/20010511..Accept: */*..Accept-Lan guage: en..Accept-Encoding: gzip,deflate,compress,identity..Accept-Charset: ISO-8859-1, utf-8; q=0.667, *; q=0.667..Keep-Alive: 300..Connection: keep- alive.... ## U 208.12.36.67:1052 -> 208.12.36.255:135 ........3;..............3;.i.............%]vM\.....$C...................... ..... # T 208.12.36.110:80 -> 208.12.36.155:4354 [A] HTTP/1.1 200 OK..Date: Thu, 24 May 2001 06:02:51 GMT..Server: Apache/1.3.19 (Unix) (Red-Hat/Linux) mod_ssl/2.8.1 OpenSSL/0.9.6 DAV/1.0.2 PHP/4.0.4pl1 mod_perl/1.24_01..Last-Modified: Thu, 17 May 2001 00:10:45 GMT..ETag: "320 2d8-a87-3b031705"..Accept-Ranges: bytes..Content-Length: 2695..Keep-Alive: timeout=15, max=100..Connection: Keep-Alive..Content-Type: text/xml....<roo t>. <child>This is a child node</child>. <child>This is a child node< /child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a c hild node</child>. <child>This is a child node</child>. <child>This i s a child node</child>. <child>This is a child node</child>. <child>T his is a child node</child>. <child>This is a child node</child>. <ch ild>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</chil d>. <child>This is a child node</child>. <child>This is a child node< /child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a c hild node</child>. <child>This is a child node</child>. <child>This i s a child node</child>. <child>This is a child node</child>. <child>T his is a child node</child>. <child>This is a child node</child>. <ch ild>This is a child node</child>. # T 208.12.36.110:80 -> 208.12.36.155:4354 [A] <child>This is a child node</child>. <child>This is a child node</chil d>. <child>This is a child node</child>. <child>This is a child node< /child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a c hild node</child>. <child>This is a child node</child>. <child>This i s a child node</child>. <child>This is a child node</child>. <child>T his is a child node</child>. <child>This is a child node</child>. <ch ild>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</chil d>. <child>This is a child node</child>. <child>This is a child node< /child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a c hild node</child>. <child>This is a child node</child>. <child>This i s a child node</child>. <child>This is a child node</child>. <child>T his is a child node</child>. <child>This is a child node</child>. <ch ild>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a child node</chil d>. <child>This is a child node</child>. <child>This is a child node< /child>. <child>This is a child node</child>. <child>This is a child node</child>. <child>This is a c ## T 208.12.36.110:80 -> 208.12.36.155:4354 [AP] hild node</child>. <child>This is a child node</child>. <child>This i s a child node</child>. <child>This is a child node</child>.</root>. With current code ngrep shows: T 208.12.36.155:2743 -> 208.12.36.110:80 [AP] POST /heikki/tupshin4.xml HTTP/1.1..Host: green..User-Agent: Mozilla/5.0 (W indows; U; WinNT4.0; en-US; rv:0.9+) Gecko/20010514..Accept: text/xml;q=1, text/html;q=0.9, image/png;q=1, image/jpeg;q=1, image/gif;q=0.9, text/plain ;q=0.8, text/css;q=1, */*;q=0.01..Accept-Language: en..Accept-Encoding: gzi p,deflate,compress,identity..Accept-Charset: ISO-8859-1, utf-8; q=0.667, *; q=0.667..Keep-Alive: 300..Connection: keep-alive.. ## T 208.12.36.155:2743 -> 208.12.36.110:80 [AP] Content-type: text/xml..Content-Length: 13....<test></test>.. ## U 208.12.36.110:800 -> 205.217.237.150:2049 ..|6...........................(........green.mcom.com.....0...0.......0... ........ EZ0..... ....0ZE..........[...H.....public.. # U 205.217.237.150:2049 -> 208.12.36.110:800 ..|6........................... EZ0..... ....c7;*[........[...H............ .......)..........................................c7;;.M.....:...%..h:...%. .h..................)...........0.......0......................0ZE;.;.#.=.; .:.6.v.;.:.6.v. # U 208.12.36.110:800 -> 205.217.237.150:2049 ..|6...........................(........green.mcom.com.....0...0.......0... ........ EZ0..... ....c7;*[........[...H.....work # U 205.217.237.150:2049 -> 208.12.36.110:800 ..|6........................... EZ0..... ....0....&.......[...H............ .......)..........................................0..;.M.3...;.../.uh;.../. uh..................)..........................................c7;;.M.....: ...%..h:...%..h # U 208.12.36.110:800 -> 205.217.237.150:2049 ..|6...........................(........green.mcom.com.....0...0.......0... ........ EZ0..... ....0....&.......[...H.....heikki.. # U 205.217.237.150:2049 -> 208.12.36.110:800 ..|6........................... EZ0..... ....n............[...H............ .......)..........................................n..;...1..(;...0.8.;..$.u *...................)..........................................0..;.M.3...; .../.uh;.../.uh # U 208.12.36.110:800 -> 205.217.237.150:2049 ..|6...........................(........green.mcom.com.....0...0.......0... ........ EZ0..... ....n............[...H.....tupshin4.xml # U 205.217.237.150:2049 -> 208.12.36.110:800 ..|6........................... EZ0..... ....2...C.1......[...H............ .......)..........................................2..;...0...;.......;..=;. 7h..................)..........................................n..;...1..(; ...0.8.;..$.u*. # T 208.12.36.110:80 -> 208.12.36.155:2743 [AP] HTTP/1.1 405 Method Not Allowed..Date: Thu, 24 May 2001 05:42:09 GMT..Serve r: Apache/1.3.19 (Unix) (Red-Hat/Linux) mod_ssl/2.8.1 OpenSSL/0.9.6 DAV/1. 0.2 PHP/4.0.4pl1 mod_perl/1.24_01..Allow: GET, HEAD, OPTIONS, TRACE..Keep-A live: timeout=15, max=100..Connection: Keep-Alive..Transfer-Encoding: chunk ed..Content-Type: text/html; charset=iso-8859-1....134..<!DOCTYPE HTML PUBL IC "-//IETF//DTD HTML 2.0//EN">.<HTML><HEAD>.<TITLE>405 Method Not Allowed< /TITLE>.</HEAD><BODY>.<H1>Method Not Allowed</H1>.The requested method POST is not allowed for the URL /heikki/tupshin4.xml.<P>.<HR>.<ADDRESS>Apache/1 .3.19 Server at green.mcom.com Port 80</ADDRESS>.</BODY></HTML>...0....
yeah... i believe the old code didn't automatically change the method. it makes sense though that if you are going to set an upload stream that it would have to be a POST (or PUT) method, otherwise we'd simply ignore the upload stream.
I am marking this INVALID, because the usage that prompts this is so weird (open with GET method but try to send data to server while getting a file). I may end up throwing an error in the send() method if I detect this.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Hi Heikki, Couldn't you just ignore the pagemeter altogether if the method is "GET"? IIRC, that's what ie5+ does.
Ok, I'll go with that.
I'll just do a little cleanup... Sorry for spam.
No longer blocks: 73958, 82032
Severity: blocker → major
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: XMLHttpRequest stopped working, server responds 403 Forbidden or 405 Method Not Allowed → XMLHttpRequest send() must ignore argument if open() method is GET
The fix for this went in with bug 73958 on trunk and 0.9.1 branch.
Status: REOPENED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
Marking verified in the June 04 trunk and branch builds.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.