HTTP_UPDATE(3)

NAME
http_update - updates a HTTP context object

SYNOPSIS

#include <slweb/http.h>

int http_update(struct http_ctx *h, bool *write, bool *close);

DESCRIPTION
The http_update() function updates a struct http_ctx object previously allocated by http_alloc(3), handling any pending data to be received/sent from/to a client. This function might call one or more of the callbacks defined by the struct http_cfg object given by the previous call to http_alloc(3). http_update shall assign the bool object pointed to by write to true if there is pending data to be sent to the client. Otherwise, it shall assigned to false. http_update() shall assign the bool object pointed to by close to true if the connection must be closed by the caller. Otherwise, it shall be assigned to false. This function should be called anytime there is available data for input or output.

RETURN VALUE
On success, zero is returned. If a fatal error ocurrs, a negative integer is returned. If a non-fatal error caused by malformed client input occurs, a positive integer is returned and the connection against the client shall be closed.

ERRORS
No errors are defined.

NOTES
This function is designed for internal use by slweb.

SEE ALSO
http_free(3), http_update(3), slweb_http(7).

COPYRIGHT
Copyright (C) 2023 Xavier Del Campo Romero.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.