in reply to Re: write a small Perl HTTP server
in thread write a small Perl HTTP server

Uh, that regexp can't be right. For one thing, the argument to GET is a URL and doesn't have to start with a slash; and there's usually an HTTP version string afterwards.

Replies are listed 'Best First'.
Re^3: write a small Perl HTTP server
by bart (Canon) on Jul 09, 2004 at 06:11 UTC
    The argument does start with a slash if your "server" is not working as a proxy, and the HTTP string comes after the space, which is also matched with the regex.
      No, that's incorrect:

      The HTTP RFC (2616) defines the Request-Line thus (section 5.1):

      Request-Line   = Method SP Request-URI SP HTTP-Version CRLF

      And Request-URI thus:

      Request-URI    = "*" | absoluteURI | abs_path | authority

      So although you *may* supply an absolute path as an argument to GET, you may also supply a URI; in fact, you'll see that that's what virtually all clients send, because otherwise virtual hosts will be broken.
        Virtual Hosts work with a Host: field in the header. An URI is syntactically correct in this place, however the semantic is "proxy this". It's mentioned because the protocol for proxies is HTTP too.