understanding POST method

Red Squirrel

No Lifer
May 24, 2003
70,623
13,818
126
www.anyf.ca
Can someone explain me why this won't work?

I am sending this to the server (my own LAN server, not trying to hack no one or anything, this is just experimental :) )


POST /icetekstest/newforum/index.php? HTTP/1.1
HOST: workstation1
User-Agent: IB-BOT 0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
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
Referer:
Cookie: pass_hash=81dc9bdb52d04dc20036dbd8313ed055; member_id=3
Content-Type: multipart/form-data; boundary=---------------------------265001916
915724
Content-Length: 2040
-----------------------------265001916915724
Content-Disposition: form-data; name="st"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="act"

POST
-----------------------------265001916915724
Content-Disposition: form-data; name="s"


-----------------------------265001916915724
Content-Disposition: form-data; name="f"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="MAX_FILE_SIZE"


-----------------------------265001916915724
Content-Disposition: form-data; name="CODE"

07
-----------------------------265001916915724
Content-Disposition: form-data; name="t"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="bbmode"

normal
-----------------------------265001916915724
Content-Disposition: form-data; name="ffont"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="fsize"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="fcolor"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="tagcount"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="helpbox"

Hint: Use Guided Mode for helpful prompts
-----------------------------265001916915724
Content-Disposition: form-data; name="Post"

11fsdf sdfsfsfdssdf
-----------------------------265001916915724
Content-Disposition: form-data; name="enableemo"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="enablesig"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="enabletrack"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="QPost"


-----------------------------265001916915724
Content-Disposition: form-data; name="QAuthor"


-----------------------------265001916915724
Content-Disposition: form-data; name="QAuthorN"


-----------------------------265001916915724
Content-Disposition: form-data; name="QDate"


-----------------------------265001916915724
Content-Disposition: form-data; name="iconid"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="FILE_UPLOAD"; filename=""
Content-Type: application/octet-stream


-----------------------------265001916915724
Content-Disposition: form-data; name="mod_options"

nowt
-----------------------------265001916915724

0




reply:

HTTP/1.1 400 Bad Request
Date: Wed, 23 Jul 2003 00:57:42 GMT
Server: Apache/1.3.24 (Win32) PHP/4.2.0
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

1bd
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Request header field is missing colon separator.<P>
<PRE>
-----------------------------265001916915724</PRE>
<P>
<HR>
<ADDRESS>Apache/1.3.24 Server at <A HREF="mailto:reliexec@nt.net">IceTeks_Intern
al_Server</A> Port 80</ADDRESS>
</BODY></HTML>

0




Other than the content lenght (have no clue yet how that works, but I posted data without the right number before fine, it just cuts off some data) I can't find anything wrong with this compared to what I see in my packet sniffer when I post using my browser. This is the reply from the server:

POST /icetekstest/newforum/index.php? HTTP/1.1
HOST: workstation1
User-Agent: IB-BOT 0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
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
Referer:
Cookie: pass_hash=81dc9bdb52d04dc20036dbd8313ed055; member_id=3
Content-Type: multipart/form-data; boundary=---------------------------265001916
915724
Content-Length: 2040
-----------------------------265001916915724
Content-Disposition: form-data; name="st"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="act"

POST
-----------------------------265001916915724
Content-Disposition: form-data; name="s"


-----------------------------265001916915724
Content-Disposition: form-data; name="f"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="MAX_FILE_SIZE"


-----------------------------265001916915724
Content-Disposition: form-data; name="CODE"

07
-----------------------------265001916915724
Content-Disposition: form-data; name="t"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="bbmode"

normal
-----------------------------265001916915724
Content-Disposition: form-data; name="ffont"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="fsize"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="fcolor"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="tagcount"

0
-----------------------------265001916915724
Content-Disposition: form-data; name="helpbox"

Hint: Use Guided Mode for helpful prompts
-----------------------------265001916915724
Content-Disposition: form-data; name="Post"

11fsdf sdfsfsfdssdf
-----------------------------265001916915724
Content-Disposition: form-data; name="enableemo"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="enablesig"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="enabletrack"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="QPost"


-----------------------------265001916915724
Content-Disposition: form-data; name="QAuthor"


-----------------------------265001916915724
Content-Disposition: form-data; name="QAuthorN"


-----------------------------265001916915724
Content-Disposition: form-data; name="QDate"


-----------------------------265001916915724
Content-Disposition: form-data; name="iconid"

1
-----------------------------265001916915724
Content-Disposition: form-data; name="FILE_UPLOAD"; filename=""
Content-Type: application/octet-stream


-----------------------------265001916915724
Content-Disposition: form-data; name="mod_options"

nowt
-----------------------------265001916915724

0




reply:

HTTP/1.1 400 Bad Request
Date: Wed, 23 Jul 2003 00:57:42 GMT
Server: Apache/1.3.24 (Win32) PHP/4.2.0
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

1bd
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
Request header field is missing colon separator.<P>
<PRE>
-----------------------------265001916915724</PRE>
<P>
<HR>
<ADDRESS>Apache/1.3.24 Server at <A HREF="mailto:reliexec@nt.net">IceTeks_Intern
al_Server</A> Port 80</ADDRESS>
</BODY></HTML>

0



Why is it referring to -----------------------------265001916915724? I checked more carfully and it's referring to the first one right here:

Content-Length: 2040
-----------------------------265001916915724
Content-Disposition: form-data; name="st"



Anyone have any ideas why this is happening? I think it may be the content lenght though, but I'm not sure. Like I said, I had successfull POSTs using a "non browser" program. I also noticed if I make the program wait for data, sometimes it will just stay stuck there, but in this case I do get a response even if I wait for data (instead of just shutting the connection right after).


Oh, and I tested this on a Unix server and got the same thing as well.

Any suggestions on how to get this to work would be appreciated, Thanks