[Prev][Next][Index][Thread]

Re: Creating a simple post request



In reply to Erik's Query about Forms and HTLoadAbsolute :

HTLoadAbsolute (or any other Load, for that matter) invokes
the HTLoad which in turn invokes the "final" LOAD call
depending on the protocol specified e.g., HTTPLoad etc.
Inside HTTPLoad, HTTPSendRequest() is invoked which actually
sends the request to the remote site (socket connection for
which has already been made). It is in this HTTPSendRequest
that the "commad" is formed which includes the method name
(GET, POST..), other headers (Accept, Content-Length...)
and (after a blank line, CR+LF), the "body" of the command.

It is in this body that the post-data is copied. You can
write whatever you feel like, as long as the receiving server
can parse and handle it (thru htbin or your CGI script).
If the post-data is generated from a "form" it contains
the name=value pairs... you can however write what you want.

Note : These observation are based on the LineMode Browser
(the libwww however has to be the same (??)) which does not
support forms or POST. I however made a patch in HTTP.c (HTTPSendRequest)
to make the method = POST (default is GET), and append the
Content-Length field and some data as the body. At the
recieving side, the CGI script can read the data from stdin
and do whatever is necessary. Thsi way I don't need "forms"
support. The method of sending the output from the CGI
remains the same - like any other nph-cgi.

I'm not sure if this helps you in any way.

amit