man(1) Manual page archive


     HTTPD(8)                                                 HTTPD(8)

     NAME
          httpd, echo, save, imagemap, man2html - HTTP server

     SYNOPSIS
          ip/httpd/httpd [-a srvaddr] [-d domain] [-n namespace] [-w
          webroot]

          ip/httpd/echo [-b inbuf] [-d domain] [-r remoteip] [-w
          webroot] [-N netdir] method version uri [search]

          ip/httpd/save [-b inbuf] [-d domain] [-r remoteip] [-w
          webroot] [-N netdir] method version uri [search]

          ip/httpd/imagemap [-b inbuf] [-d domain] [-r remoteip] [-w
          webroot] [-N netdir] method version uri

          ip/httpd/man2html [-b inbuf] [-d domain] [-r remoteip] [-w
          webroot] [-N netdir] method version uri [search]

     DESCRIPTION
          Httpd serves the webroot directory of the file system
          described by namespace (default /lib/namespace.httpd), using
          version 1.1 of the HTTP protocol.  It announces the service
          srvaddr (default tcp!*!http), and listens for incoming
          calls.

          Httpd supports only the GET and HEAD methods of the HTTP
          protocol; some magic programs support POST as well.  Persis-
          tent connections are supported for HTTP/1.1 or later
          clients; all connections close after a magic command is exe-
          cuted.  The Content-type (default application/octet-stream)
          and Content-encoding (default binary) of a file are deter-
          mined by looking for suffixes of the file name in
          /sys/lib/mimetype.

          Each requested URI is looked up in a redirection table, read
          from /sys/lib/httpd.rewrite.  If a prefix of the URI matches
          a redirection path, the URI is rewritten using a replacement
          path, and a redirect is sent to the HTTP client.  If the
          replacement path does not specify a server name, and the
          request has no explicit host, then domain is the host name
          used in the redirection.

          The redirection table also maps a URI into an authentication
          realm.  If a prefix of the URI matches a realm, the server
          negotiates a basic authentication with the client.  The
          client's credentials are checked by calling httpauth (see
          auth(2)), passing the realm and the client's supplied pass-
          word as arguments.

     HTTPD(8)                                                 HTTPD(8)

          If the requested URI begins with /magic/server/, httpd exe-
          cutes the file /bin/ip/httpd/server to finish servicing the
          request.  Method and version are those received on the first
          line of the request.  Uri is the remaining portion of the
          requested URI.  Inbuf contains the rest of the bytes read by
          the server, and netdir is the network directory for the con-
          nection.  There are routines for processing command argu-
          ments, parsing headers, etc. in the httpd library,
          /sys/src/cmd/ip/httpd/libhttpd.a.$O.  See httpd.h in that
          directory and existing magic commands for more details.

          Echo is a trivial server that just returns the method, URI,
          any search, the headers, and the message body sent by the
          client.

          Save writes a line to /usr/web/save/uri.data and returns the
          contents of /usr/web/save/uri.html.  Both files must be
          accessible for the request to succeed.  The saved line
          includes the current time and either the search string from
          a HEAD or GET or the first line of the body from a POST.  It
          is used to record form submissions.

          Imagemap processes an HTML imagemap query.  It looks up a
          the point search in the image map file given by uri, and
          returns a redirection to the appropriate page.  The map file
          defaults to NCSA format.  Any entries after a line starting
          with the word #cern are interpreted in CERN format.

          Man2html converts man(6) format manual pages into html.  It
          includes some abilities to search the manuals.

     FILES
          /sys/lib/mimetype     content type description file
          /lib/namespace.httpd  default namespace file for httpd
          /sys/lib/httpd.rewrite
                                redirection file

     SOURCE
          /sys/src/cmd/ip/httpd

     SEE ALSO
          newns in auth(2), listen(8)