Re: How come this doesn't work?



Hey You schrieb:

It just pretty much does the first request which is the post but then
when I tell it to get the other page it doesn't do anything. I made this
code a few seconds ago so I am searching for the answer and I am reading
RFC2616.

Just a few suggestions:

1. Put POSTed form variables in the request body.

2. Specify the correct Content-Type for it (application/x-www-form-urlencoded).

3. Use the "Connection: Keep-Alive" header to be able to do multiple HTTP-Requests on the same connection. (And check whether the server supports this)

4. Supply a correct Content-Length header, so the server knows where the next request starts.

5. Have a look at Net::HTTP instead of doing it manually.

6. Don't post your username and password to a public newsgroup.

;)
.



Relevant Pages

  • Re: minimal httpd response
    ... RST, abortively closing the connection. ... The responsibilities of an HTTP/1.1 proxy, and of an HTTP/1.1 server ... user agent, without a proxy, first, and then try to deal ... Connection header; with a Content-length header; or with the chunked ...
    (comp.programming)
  • Re: What is this code waiting for?
    ... and the web server is sat waiting for another request. ... the server times out the connection - and your read method returns ... open by default for further requests. ... If you send that header then the server ...
    (comp.lang.java.help)
  • Re: linux socket programming and HTTP Protocol Problem
    ... Why are you sending an *empty* content length header? ... Both web browsers connect to the server but both fail ... closing the connection before they've even *sent* their query. ...
    (comp.os.linux.development.apps)
  • Custom HTTP header
    ... I want a simple http header like the one below. ... Server: Mongrel 1.1.5 ... Connection: close ...
    (comp.lang.ruby)
  • IIS5 Dropping HTTP/1.0 HTML Connection
    ... without the keep-alive header given to it from the client end. ... We need a server side fix, the GET command will return the header and then ... drops the connection, just like if it was a HEAD command sent to it. ...
    (microsoft.public.inetserver.iis)