Http_client: module
{
PATH: con "/usr/maht/http_client/http_client.dis";
cookies : string;
Request: adt {
host : string;
method : string;
uri : string;
http_version : string;
user_agent : string;
headers : array of string;
body : array of byte;
# bytes : fn (r: self ref Request) : array of byte;
};
Response: adt {
status : list of string;
content_type : string;
headers : string;
body : array of byte;
last_modified : string; # can't be bothered to write a strftime parser
content_length : int;
read : fn(bio : ref Bufio->Iobuf) : ref Response;
to_string : fn(r : self ref Response) : string;
};
Connection : adt {
c : ref Sys->Connection;
read_response : fn(c: self ref Connection) : ref Response;
# GET : fn(c : self ref Connection, host, uri, http_version : string, headers : array of string) : ref Response;
};
POST : fn(bio : ref Bufio->Iobuf, host, uri, http_version : string, headers : list of string, body : array of byte);
new_connection:fn(dialstring : string) : ref Connection;
urlencode : fn(unencoded : string) : string;
};
|