[Pipet Devel] http protocol, was: J.W. Bizzaro; TODO 20000218
David Lapointe
dlapointe at mediaone.net
Thu Feb 24 21:40:34 EST 2000
On Thu, 24 Feb 2000, Gary Van Domselaar wrote:
> Brad Chapman wrote:
>
> > I will admit that I don't know *anything* about how http works, or
> > even the first place to get started (maybe Gary can give me some
> > clues?) but for right now I'll have the communication go on via a
> > reciever and sender class on each side, and then I can start to
> > incoporate http later.
Python has some modules (URLLIB, HTTPLIB,FTPLIB) for dealing with these.
Otherwise it's the same for everything sockets. Open a socket on a port, write and read from the
socket ( just like a file ).
Try this. Use your favorite simple web site
%telnet webssite 80
(stuff comes back)
HEAD / HTTPD/1.0<cr><cr>
or
GET / HTTPD/1.0<cr><cr>
If you want to write to a CGI, it's just a little more difficult. Basically
collect all of the name=value pairs into a big string, calculate the length of the string, construct the headers, send it
and get ready for the result. For http make sure you have a blank line between the headers and the content.
There are several header lines depending what you are doing. See "WebMaster in a Nutshell".
print "Content-length: %d\n\n%s",length(stringnamevalues),stringnamevalues,
--
.david
David Lapointe
I can't understand why people are frightened by new ideas. I'm
frightened of old ones -- John Cage
More information about the Pipet-Devel
mailing list