Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I'm begging for help: multipart/form-data request rejected by server

30 views
Skip to first unread message

Piter

unread,
Mar 29, 2005, 1:33:21 PM3/29/05
to
I have a problem which is driving me mad because I seem to be doing
everything
like I should and yet I'm getting and error message.

I wrote an application which sends an HTTP request to the server. This is a
POST
request and I cite it at the end of this message. In my opinion it is fully
compatible with the multipart/form-data content type specification. But my
server rejects it and return a 400 Bad Request error. Why? Do you have any
idea?

POST /test.php HTTP/1.1
User-Agent: UNTRUSTED/1.0
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--boundary---
Content-Length: 9658
Host: www.myserver.com
Transfer-Encoding: chunked

000000 39 61 34 0D 0A 2D 2D 62 6F 75 6E 64 61 72 79 2D 9a4..--boundary-
000010 2D 2D 0D 0A 43 6F 6E 74 65 6E 74 2D 44 69 73 70 --..Content-Disp
000020 6F 73 69 74 69 6F 6E 3A 20 66 6F 72 6D 2D 64 61 osition: form-da
000030 74 61 3B 20 6E 61 6D 65 3D 22 44 61 6E 65 5A 64 ta; name="Custom
000040 6A 65 63 69 61 22 0D 0A 0D 0A 30 30 30 30 30 30 erDta"....000000
000050 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000

(...) - Here go another 2000 zeros which act as test values that should be
assigned to the CustomerDta variable.

000990 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
0009A0 30 30 30 30 30 30 30 30 30 0D 0A 39 61 34 0D 0A 000000000..9a4..
0009B0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000

(...)

001330 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
001340 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
001350 30 30 30 30 0D 0A 39 61 34 0D 0A 30 30 30 30 30 0000..9a4..00000
001360 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000

(...)

0025B0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
0025C0 30 30 30 0D 0A 2D 2D 62 6F 75 6E 64 61 72 79 2D 000..--boundary-
0025D0 2D 2D 0D 0A 0D 0A 30 0D 0A 0D 0A --....0....


googl...@hotpop.com

unread,
Mar 29, 2005, 10:52:36 PM3/29/05
to
I've done this sort of programming before. It's been awhile though. My
advice is to load up Squid, set firefox to use it as proxy, and do a
normal form post from firefox to your local Apache web and PHP server
instead of through your application. Then, compare the results by
looking in Squid's log file. You'll have to turn on full logging. If
they differ, then perhaps you need to make your byte stream look more
like the byte stream that firefox sends.

BTW, if you're new to Squid and can't seem to install it properly, then
install a free copy of RH9 (which many vendors sell for like $4 to burn
the CDRs for you, and usually under a different name). It comes with
Squid. Fedora probably does to, but I've only used RH9 for now.

Another route is to use netcat (known as nc) and make it pretend to be
a webserver, ready to receive the web post from firefox. This will
generate an output that you can compare to what your application is
generating.

And then there's also the original RFC spec., but I bet you've already
poured over that for hours and hours.

0 new messages