Open and execute an HTTP query.
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; }
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; }
int Protocols.HTTP.Query.errno
Errno copied from the connection.
int Protocols.HTTP.Query.ok
Tells if the connection is successfull.
mapping Protocols.HTTP.Query.headers
Headers as a mapping. All header names are in lower case, for convinience.
string Protocols.HTTP.Query.protocol
Protocol string, ie "HTTP/1.0".
"HTTP/1.0"
int Protocols.HTTP.Query.status string Protocols.HTTP.Query.status_desc
Status number and description (eg 200 and "ok").
200
"ok"
string Protocols.HTTP.Query.host int Protocols.HTTP.Query.port
Connected host and port.
Used to detect whether keep-alive can be used.
mapping Protocols.HTTP.Query.hostname_cache
Set this to a global mapping if you want to use a cache, prior of calling *request().