Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/limbo/http_client/http_client.m

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



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;
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.