Skip to content

Procedures: Add HTTP API #3517

@gefjon

Description

@gefjon

Add a single new host call for performing an HTTP request, procedure_http_request. Its signature is approximately:

extern "C" fn procedure_http_request(req: *const u8, req_len: u32, out: *mut BytesSource) -> Errno;

The (req, req_len) buffer encodes an HttpRequest object. Decide whether this should be re-exported from the http crate, some other crate, or our own custom type. Justify your choice in the PR description.

The out BytesSource has meaning depending on the return value: if the call returns ok, out yields an HttpResponse object. (This may be an HTTP error response; the call assigns no semantics to HTTP responses whatsoever.) If the call returns an error, out yields an HttpError further describing the failure.

Wrap this up in a method on ProcedureContext which handles the ser/de parts. Its signature is approximately:

impl ProcedureContext {
    pub fn http(&mut self, req: HttpRequest) -> Result<HttpResponse, HttpError> { todo!() }
}

Then make follow-up tickets to expose the same interface in C#, C++ and TypeScript.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions