John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

A friend of mine is working on some web stuff, which uses Apache and mod_perl. But he's also experimenting with an idea that centers around a dedicated program that talks on port 80 just like a web server, as a front end to something.

He's read the old Steven's book, but it's too low level. Can someone recomend a book or other source of information to learn how to do that? How to read the whole request record, how does "keepalive" work if the return channel must be closed for Netscape to know it's done? Zillions of questions, big and small.

—John

  • Comment on Slightly OT: HTTP protocal documentation?

Replies are listed 'Best First'.
Re: Slightly OT: HTTP protocal documentation?
by wog (Curate) on Sep 18, 2001 at 01:09 UTC
    The HTTP standard is described in RFC 2616. It should be able to answer all your questions.

    As for one question, note that keepalive doesn't work if the return channel must be closed for the client to know it's done. The connection can only be kept alive when a "Content-Length" header is returned (so the client knows how much data to read.)

Re: Slightly OT: HTTP protocal documentation?
by chromatic (Archbishop) on Sep 18, 2001 at 01:58 UTC
    The RFCs are the place to go, but there are already dedicated programs that can speak HTTP as a front end to something. POE is one, and Jellybean is another. Of course, there's nothing wrong with using HTTP::Daemon, which handles many of the details for you.
Re: Slightly OT: HTTP protocal documentation?
by stefp (Vicar) on Sep 18, 2001 at 01:11 UTC
    I guess he should RTF RFC rfc 2068. What do you expect as answer to such a vast question? :)

    or better rfc2616 (like wog said). rfc2616 that obsoletes the one I gave.

    -- stefp

      What do you expect as answer to such a vast question?

      Something along the lines of "I read so-and-so's book (link to Fatbrain) and it was right at that practical level." or "there's this module that's designed as a mini-HTTP server for embedded in stand-alone appliances; take a look at that."

      In short, I expect what I commonly see from Monks here. Useful, insightful, and thoughful answers of the "teach him to fish" variety.

      —John

        Both POE and LWP include mini HTTP servers. However, you're almost certainly better off sticking with mod_perl. You're unlikely to get significantly better performance, and you'll be taking on a lot more work if you build your own. So, if it's just for kicks, read the RFC and have a blast, but if it's a practical project, stick with mod_perl.
        Sorry for being rude (and inexact) but it is difficult to answer more specifically even by pointers to another source except the RFCs themselves when your question is so vast.

        I have nothing against "teaching to fish", but I don't think this is the most well chosen medium. More like: you ask specific questions and get specific answers. Better asked first hand.

        But who I am to argue with a saint. :)

        -- stefp

Re: Slightly OT: HTTP protocal documentation?
by shotgunefx (Parson) on Sep 18, 2001 at 08:47 UTC
    I browsed through an article recently in Dr Dobbs about a embeddedable HTTP server (less than 400 lines of C). I don't know how full featured it is. Might be worth a look

    -Lee

    "To be civilized is to deny one's nature."
Re: Slightly OT: HTTP protocal documentation?
by Beatnik (Parson) on Sep 19, 2001 at 11:29 UTC
    O'Reilly has a HTTP Pocket Reference (which appears to be missing from my local bookstores O'Reilly Pocket Reference rack).

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.