[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Doing a POST
> -----Original Message-----
> From: Christopher Fowler [mailto:cfowler@outpostsentinel.com]
> Sent: Friday, August 29, 2003 03:22 PM
> To: ajug-members@ajug.org
> Subject: Doing a POST
>
>
> Hello,
>
> I'm trying to replicate what a browser does when it connects
> to one of our sites. Here is what I've caught when Mozilla accessed
> the page:
> POST /auth.asp HTTP/1.1^M
> Connection: Keep-Alive^M
> User-Agent: Mozilla/5.0 (compatible; Konqueror/3.1; Linux)^M
> Referer: http://127.0.0.1/auth.asp^M
> Pragma: no-cache^M
> Cache-control: no-cache^M
> Accept: text/*, image/jpeg, image/png, image/*, */*^M
> Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity^M
> Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5^M
> Accept-Language: en^M
> Host: 127.0.0.1^M
> Content-Type: application/x-www-form-urlencoded^M
> Content-Length: 45^M
> ^M
> login=super&password=smart&action_login=Login------------------------------------------------------------
>
>
> I'm trying to replicate the post with the following java code
If you want the HTTP headers to be written exactly as they appear above, then
copy the bytes into a file and use (or write) a simple socket client to push the file into your web port. Otherwise, you will have to find the correct APIs in your HTTP client to set the header fields to the correct values.
BTW, that's not a mozilla request; it's KDE's Konqueror. The request looks correct, just eyeballing it. It's got extra content (assuming the '-' are part of the HTTP request), but Content-Length is correct.
Kit