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.lysator.liu.se", 80, "HEAD / HTTP/1.0"); return -1; }
- Variable
buf
Variable headerbuf
stringProtocols.HTTP.Query.buf
stringProtocols.HTTP.Query.headerbuf- Description
Input buffers.
- Variable
con
Stdio.File|SSL.File|Stdio.UDPProtocols.HTTP.Query.con- Description
Connection to HTTP(s) server.
- Variable
errno
intProtocols.HTTP.Query.errno- Description
Errno copied from the connection or simulated for async operations.
- Note
In Pike 7.8 and earlier hardcoded Linux values were used in async operations, 110 instead of
System.ETIMEDOUTand 113 instead ofSystem.EHOSTUNREACH.
- Variable
request_ok
Variable request_fail
Variable extra_args
localfunction(:void)|zeroProtocols.HTTP.Query.request_ok
localfunction(:void)|zeroProtocols.HTTP.Query.request_fail
arrayProtocols.HTTP.Query.extra_args- Description
Callbacks and arguments set by set_callbacks().
- Variable
headers
mappingProtocols.HTTP.Query.headers- Description
Headers as a mapping. All header names are in lower case, for convinience.
- Variable
host
Variable real_host
Variable port
stringProtocols.HTTP.Query.host
stringProtocols.HTTP.Query.real_host
intProtocols.HTTP.Query.port- Description
Connected host and port.
Used to detect whether keep-alive can be used.
- Variable
hostname_cache
mapping(string:array(string)) Protocols.HTTP.Query.hostname_cache- Description
Set this to a global mapping if you want to use a cache, prior of calling *request().
- Variable
timeout
Variable maxtime
intProtocols.HTTP.Query.timeout
intProtocols.HTTP.Query.maxtime- Description
timeout is the time to wait in seconds on connection and/or data. If data is fetched asynchronously the watchdog will be reset every time data is received. Defaults to 120 seconds. maxtime is the time the entire operation is allowed to take, no matter if the connection and data fetching is successful. This is by default indefinitely.
- Note
These values only have effect in asynchroneous calls