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
errno
int
Protocols.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.ETIMEDOUT
and 113 instead ofSystem.EHOSTUNREACH
.
- Variable
headers
mapping
Protocols.HTTP.Query.headers- Description
Headers as a mapping. All header names are in lower case, for convinience.
- Variable
host
Variable real_host
Variable port
string
Protocols.HTTP.Query.host
string
Protocols.HTTP.Query.real_host
int
Protocols.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
int
Protocols.HTTP.Query.timeout
int
Protocols.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