Gorby has asked for the wisdom of the Perl Monks concerning the following question:

Hello Wise Monks!

I'd like to make a socket server using IO::Socket that returns a web document. I can create the server and make it respond to a socket client, but my problem is that when I use a web browser to access the socket server, the web browser refuses to display the text my server spits out. What headers exactly does my server need to syswrite to the socket in order for the web browser to recognize the page? For getting pages from a client I know it's GET / HTTP/1.0\n\n. What is it for returning a page?

Thanks in advance.

Gorby

Replies are listed 'Best First'.
Re: Spitting out a webpage
by Joost (Canon) on Sep 15, 2007 at 01:15 UTC
Re: Spitting out a webpage
by erroneousBollock (Curate) on Sep 15, 2007 at 04:27 UTC
    Try using HTTP::Response to construct your HTTP responses.

    Even if you're just doing this as a learning exercise, you can read the source of HTTP::Response to get a better idea.

    -David

Re: Spitting out a webpage
by moritz (Cardinal) on Sep 15, 2007 at 07:51 UTC