| Extracted from Pike v7.8 release 700 at 2013-06-08.

[Top]
Protocols
Protocols.HTTP
Protocols.HTTP.Query

# Class Protocols.HTTP.Query

Description

  Open and execute an HTTP query.

Example

      HTTP.Query o=HTTP.Query();
       void ok()
       {
          write("ok...\n");
          write("%O\n", o->headers);
          exit(0);
       }
       void fail()
       {
          write("fail\n");
          exit(0);
       }
       int main()
       {
          o->set_callbacks(ok, fail);
          o->async_request("pike.ida.liu.se", 80, "HEAD / HTTP/1.0");
          return -1;
       }

Variable errno

  `int Protocols.HTTP.Query.errno`

Description

  Errno copied from the connection.

Variable ok

  `int Protocols.HTTP.Query.ok`

Description

  Tells if the connection is successfull.

Variable headers

  `mapping Protocols.HTTP.Query.headers`

Description

  Headers as a mapping. All header names are in lower case, for convinience.

Variable protocol

  `string Protocols.HTTP.Query.protocol`

Description

  Protocol string, ie `"HTTP/1.0"`.

  `int Protocols.HTTP.Query.status`
  `string Protocols.HTTP.Query.status_desc`

Description

  Status number and description (eg `200` and `"ok"`).

  `string Protocols.HTTP.Query.host`
  `int Protocols.HTTP.Query.port`

Description

  Connected host and port.

  Used to detect whether keep-alive can be used.

Variable hostname_cache

  `mapping Protocols.HTTP.Query.hostname_cache`

Description

  Set this to a global mapping if you want to use a cache, prior of calling *request().