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

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



Httpc: module
{
	PATH : con "/appl/lib/httpc.dis";
	
	debug : int;

	Request: adt {
		host : string;
		method : string;
		uri : string;
		http_version : string;
		user_agent : string;
		headers : list of string;
		body : array of byte;
		header_bytes : fn (r: self ref Request) : array of byte;
	};

	Response: adt {
		status : list of string;
		content_type : string;
		headers : string;
		body : list of array of byte;
		last_modified : string; # can't be bothered to write a strftime parser
		content_length : int;
		body_string: fn(r : self ref Response) : string;
		to_string : fn(r : self ref Response) : string;
	};


	Connection : adt {
		c : ref Sys->Connection;
 		ssl_connection:	ref SSL3->Context;
 		ssl_vers:	int;
		
		send_request: fn(c: self ref Connection, r : ref Request) : ref Response;
		read_response: fn(c: self ref Connection) : ref Response;
		gets: fn(c: self ref Connection, delim : byte) : string;
		read_chunked: fn(c: self ref Connection) : list of array of byte;
		read_unchunked: fn(c: self ref Connection, block_size:int) : list of array of byte;

	};

	init: fn();
	new_connection:fn(dialstring : string) : ref Connection;
	new_ssl_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 [email protected].