63 #define EACCES_401 __einfo_error ( EINFO_EACCES_401 ) 64 #define EINFO_EACCES_401 \ 65 __einfo_uniqify ( EINFO_EACCES, 0x01, "HTTP 401 Unauthorized" ) 66 #define EINVAL_STATUS __einfo_error ( EINFO_EINVAL_STATUS ) 67 #define EINFO_EINVAL_STATUS \ 68 __einfo_uniqify ( EINFO_EINVAL, 0x01, "Invalid status line" ) 69 #define EINVAL_HEADER __einfo_error ( EINFO_EINVAL_HEADER ) 70 #define EINFO_EINVAL_HEADER \ 71 __einfo_uniqify ( EINFO_EINVAL, 0x02, "Invalid header" ) 72 #define EINVAL_CONTENT_LENGTH __einfo_error ( EINFO_EINVAL_CONTENT_LENGTH ) 73 #define EINFO_EINVAL_CONTENT_LENGTH \ 74 __einfo_uniqify ( EINFO_EINVAL, 0x03, "Invalid content length" ) 75 #define EINVAL_CHUNK_LENGTH __einfo_error ( EINFO_EINVAL_CHUNK_LENGTH ) 76 #define EINFO_EINVAL_CHUNK_LENGTH \ 77 __einfo_uniqify ( EINFO_EINVAL, 0x04, "Invalid chunk length" ) 78 #define EIO_OTHER __einfo_error ( EINFO_EIO_OTHER ) 79 #define EINFO_EIO_OTHER \ 80 __einfo_uniqify ( EINFO_EIO, 0x01, "Unrecognised HTTP response code" ) 81 #define EIO_CONTENT_LENGTH __einfo_error ( EINFO_EIO_CONTENT_LENGTH ) 82 #define EINFO_EIO_CONTENT_LENGTH \ 83 __einfo_uniqify ( EINFO_EIO, 0x02, "Content length mismatch" ) 84 #define EIO_4XX __einfo_error ( EINFO_EIO_4XX ) 85 #define EINFO_EIO_4XX \ 86 __einfo_uniqify ( EINFO_EIO, 0x04, "HTTP 4xx Client Error" ) 87 #define EIO_5XX __einfo_error ( EINFO_EIO_5XX ) 88 #define EINFO_EIO_5XX \ 89 __einfo_uniqify ( EINFO_EIO, 0x05, "HTTP 5xx Server Error" ) 90 #define ENOENT_404 __einfo_error ( EINFO_ENOENT_404 ) 91 #define EINFO_ENOENT_404 \ 92 __einfo_uniqify ( EINFO_ENOENT, 0x01, "Not found" ) 93 #define ENOTSUP_CONNECTION __einfo_error ( EINFO_ENOTSUP_CONNECTION ) 94 #define EINFO_ENOTSUP_CONNECTION \ 95 __einfo_uniqify ( EINFO_ENOTSUP, 0x01, "Unsupported connection header" ) 96 #define ENOTSUP_TRANSFER __einfo_error ( EINFO_ENOTSUP_TRANSFER ) 97 #define EINFO_ENOTSUP_TRANSFER \ 98 __einfo_uniqify ( EINFO_ENOTSUP, 0x02, "Unsupported transfer encoding" ) 99 #define EPERM_403 __einfo_error ( EINFO_EPERM_403 ) 100 #define EINFO_EPERM_403 \ 101 __einfo_uniqify ( EINFO_EPERM, 0x01, "HTTP 403 Forbidden" ) 102 #define EPROTO_UNSOLICITED __einfo_error ( EINFO_EPROTO_UNSOLICITED ) 103 #define EINFO_EPROTO_UNSOLICITED \ 104 __einfo_uniqify ( EINFO_EPROTO, 0x01, "Unsolicited data" ) 107 #define HTTP_RETRY_SECONDS 5 172 if ( consumed < 0 ) {
174 DBGC ( http,
"HTTP %p could not buffer line: %s\n",
202 while ( (
isspace ( **line ) ) || ( **line ==
',' ) )
211 while ( (
c = **line ) ) {
214 if ( (
isspace (
c ) || (
c ==
',' ) ) && ! quote )
229 if ( (
c ==
'"' ) || (
c ==
'\'' ) ) {
317 DBGC ( http,
"HTTP %p could not reconnect: %s\n",
372 if ( (
rc = http->
state->
tx ( http ) ) != 0 )
398 while ( iobuf &&
iob_len ( iobuf ) ) {
402 DBGC ( http,
"HTTP %p unexpected data\n", http );
408 if ( (
rc = http->
state->
rx ( http, &iobuf ) ) != 0 )
606 struct uri request_uri;
607 struct uri request_host;
608 size_t request_uri_len;
609 size_t request_host_len;
611 char *request_uri_string;
612 char *request_host_string;
617 memset ( &request_uri, 0,
sizeof ( request_uri ) );
624 memset ( &request_host, 0,
sizeof ( request_host ) );
631 content_len = ( content ? content->
len : 0 );
634 http =
zalloc (
sizeof ( *http ) + request_uri_len + request_host_len +
640 request_uri_string = ( ( (
void * ) http ) +
sizeof ( *http ) );
641 request_host_string = ( request_uri_string + request_uri_len );
642 content_data = ( request_host_string + request_host_len );
643 format_uri ( &request_uri, request_uri_string, request_uri_len );
644 format_uri ( &request_host, request_host_string, request_host_len );
665 memcpy ( content_data, content->
data, content_len );
673 DBGC ( http,
"HTTP %p could not connect: %s\n",
698 const char *location ) {
699 struct uri *location_uri;
700 struct uri *resolved_uri;
703 DBGC2 ( http,
"HTTP %p redirecting to \"%s\"\n", http, location );
707 if ( ! location_uri ) {
714 if ( ! resolved_uri ) {
716 goto err_resolve_uri;
721 resolved_uri ) ) != 0 ) {
722 DBGC ( http,
"HTTP %p could not redirect: %s\n",
743 const char *location;
781 DBGC2 ( http,
"HTTP %p performing %s authentication\n",
784 DBGC ( http,
"HTTP %p could not authenticate: %s\n",
810 DBGC2 ( http,
"HTTP %p retrying after %d seconds\n",
847 DBGC2 ( http,
"HTTP %p TX %s\n", http, buf );
848 used +=
ssnprintf ( ( buf + used ), (
len - used ),
"\r\n" );
855 if ( value_len < 0 ) {
865 line = ( buf + used );
866 used +=
ssnprintf ( ( buf + used ), (
len - used ),
"%s: ",
868 remaining = ( ( used <
len ) ? (
len - used ) : 0 );
869 used +=
header->format ( http, ( buf + used ), remaining );
871 DBGC2 ( http,
"HTTP %p TX %s\n", http, line );
872 used +=
ssnprintf ( ( buf + used ), (
len - used ),
"\r\n" );
887 "%s: %s\r\n",
param->key,
893 used +=
ssnprintf ( ( buf + used ), (
len - used ),
"\r\n" );
928 char *buf,
size_t len ) {
936 .
name =
"User-Agent",
949 char *buf,
size_t len ) {
957 .
name =
"Connection",
970 char *buf,
size_t len ) {
998 char *buf,
size_t len ) {
1010 .
name =
"Content-Type",
1023 char *buf,
size_t len ) {
1035 .
name =
"Content-Length",
1048 char *buf,
size_t len ) {
1050 const char *sep =
"";
1058 "%s%s", sep, encoding->
name );
1067 .
name =
"Accept-Encoding",
1087 DBGC ( http,
"HTTP %p could not construct request: %s\n",
1109 DBGC ( http,
"HTTP %p could not deliver request: %s\n",
1157 DBGC2 ( http,
"HTTP %p RX %s\n", http, line );
1162 DBGC ( http,
"HTTP %p malformed version \"%s\"\n", http, line );
1168 if ( vernum[0] ==
'0' ) {
1170 }
else if (
strncmp ( vernum,
"1.0", 3 ) == 0 ) {
1180 if ( *endp !=
' ' ) {
1181 DBGC ( http,
"HTTP %p malformed status code \"%s\"\n",
1187 if (
status[0] ==
'2' ) {
1190 }
else if (
status[0] ==
'3' ) {
1192 response_rc = -
EXDEV;
1202 }
else if (
status[0] ==
'4' ) {
1205 }
else if (
status[0] ==
'5' ) {
1214 DBGC ( http,
"HTTP %p status %s\n", http,
status );
1231 DBGC2 ( http,
"HTTP %p RX %s\n", http, line );
1234 sep =
strchr ( line,
':' );
1236 DBGC ( http,
"HTTP %p malformed header \"%s\"\n", http, line );
1249 return header->parse ( http, line );
1332 DBGC ( http,
"HTTP %p unrecognised Transfer-Encoding \"%s\"\n",
1340 .
name =
"Transfer-Encoding",
1367 .
name =
"Connection",
1384 if ( *endp !=
'\0' ) {
1385 DBGC ( http,
"HTTP %p invalid Content-Length \"%s\"\n",
1399 .
name =
"Content-Length",
1432 DBGC ( http,
"HTTP %p unrecognised Content-Encoding \"%s\"\n",
1440 .
name =
"Content-Encoding",
1457 if ( *endp !=
'\0' ) {
1464 DBGC ( http,
"HTTP %p cannot understand Retry-After \"%s\"; " 1476 .
name =
"Retry-After",
1501 if ( ( line ==
NULL ) || ( line[0] !=
'\0' ) )
1510 ( (
rc = content->
init ( http ) ) != 0 ) ) {
1511 DBGC ( http,
"HTTP %p could not initialise %s content " 1538 if ( (
rc = transfer->
init ( http ) ) != 0 ) {
1539 DBGC ( http,
"HTTP %p could not initialise %s transfer " 1598 DBGC ( http,
"HTTP %p content length overrun\n", http );
1636 DBGC ( http,
"HTTP %p content length underrun\n", http );
1703 if ( ( line ==
NULL ) || ( line[0] ==
'\0' ) )
1708 if ( *endp !=
'\0' ) {
1709 DBGC ( http,
"HTTP %p invalid chunk length \"%s\"\n",
1749 crlf = ( (*iobuf)->data + http->
remaining );
1750 if ( ( crlf[0] ==
'\r' ) && ( crlf[1] ==
'\n' ) )
1756 if ( len <= http->remaining ) {
1847 if ( ( line ==
NULL ) || ( line[0] !=
'\0' ) )
1897 if ( remaining > 0 )
1908 remaining -= frag_len;
1911 if ( remaining > 0 )
1921 remaining -= frag_len;
1925 if ( remaining > 0 )
1956 type =
"application/x-www-form-urlencoded";
struct interface xfer
Data transfer interface.
#define iob_pull(iobuf, len)
const char * equery
Query (with original URI encoding)
An object interface operation.
struct arbelprm_rc_send_wqe rc
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
void intf_close(struct interface *intf, int rc)
Close an object interface.
static struct profiler http_rx_profiler __profiler
Receive profiler.
void intf_restart(struct interface *intf, int rc)
Shut down and restart an object interface.
static __always_inline void off_t int c
Content length specified.
#define iob_put(iobuf, len)
#define TICKS_PER_SEC
Number of ticks per second.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
static void uri_put(struct uri *uri)
Decrement URI reference count.
int xfer_deliver_iob(struct interface *intf, struct io_buffer *iobuf)
Deliver datagram as I/O buffer without metadata.
void(* close)(struct http_transaction *http, int rc)
Server connection closed.
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
size_t uri_encode_string(unsigned int field, const char *string, char *buf, ssize_t len)
Encode URI field string.
const char * host
Server host name.
static struct uri * uri_get(struct uri *uri)
Increment URI reference count.
static struct interface_operation http_conn_operations[]
HTTP server connection interface operations.
struct http_method http_head
HTTP HEAD method.
uint32_t next
Next descriptor address.
HTTP request range descriptor.
#define for_each_param(param, params)
Iterate over all request parameters in a list.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct interface conn
Server connection.
static void http_expired(struct retry_timer *timer, int over __unused)
Handle retry timer expiry.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static void http_close(struct http_transaction *http, int rc)
Close HTTP transaction.
static struct interface_descriptor http_transfer_desc
HTTP transfer-decoded interface descriptor.
static int http_redirect(struct http_transaction *http, const char *location)
Redirect HTTP transaction.
uint32_t type
Operating system type.
static int http_parse_header(struct http_transaction *http, char *line)
Parse HTTP header.
static int http_parse_headers(struct http_transaction *http)
Parse HTTP response headers.
#define __einfo_errortab(einfo)
#define EPIPE
Broken pipe.
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
A request parameter list.
static int http_rx_trailers(struct http_transaction *http, struct io_buffer **iobuf)
Handle received HTTP trailer.
struct line_buffer linebuf
Temporary line buffer.
static int http_tx_request(struct http_transaction *http)
Transmit request.
static struct interface_descriptor http_content_desc
HTTP content-decoded interface descriptor.
struct http_request_header http_request_host __http_request_header
HTTP "Host" header ".
static struct http_transfer_encoding http_transfer_identity
Identity transfer encoding.
int(* tx)(struct http_transaction *http)
Transmit data.
struct uri * uri
Request URI.
static struct xfer_buffer * http_content_buffer(struct http_transaction *http)
Get underlying data transfer buffer.
__weak int http_block_read_capacity(struct http_transaction *http __unused, struct interface *data __unused)
Read block device capacity (when HTTP block device support is not present)
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
static int http_parse_connection(struct http_transaction *http, char *line)
Parse HTTP "Connection" header.
unsigned long long uint64_t
const char * location
Redirection location.
int strcasecmp(const char *first, const char *second)
Compare case-insensitive strings.
struct http_state * state
Transaction state.
static int http_format_connection(struct http_transaction *http __unused, char *buf, size_t len)
Construct HTTP "Connection" header.
int block_read(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, userptr_t buffer, size_t len)
Read from block device.
REQUIRE_OBJECT(config_http)
REQUIRING_SYMBOL(http_open)
An HTTP authentication scheme.
static int http_conn_deliver(struct http_transaction *http, struct io_buffer *iobuf, struct xfer_metadata *meta __unused)
Handle received HTTP data.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define PROC_DESC_ONCE(object_type, process, _step)
Define a process descriptor for a process that runs only once.
This protocol can be used on any device handle to obtain generic path/location information concerning...
EFI_DEVICE_PATH_PROTOCOL * efi_uri_path(struct uri *uri)
Construct EFI device path for URI.
void intfs_shutdown(int rc,...)
Shut down multiple object interfaces.
A data structure for storing profiling information.
Uniform Resource Identifiers.
static void profile_stop(struct profiler *profiler)
Stop profiling.
An HTTP content encoding.
int strncmp(const char *first, const char *second, size_t max)
Compare strings.
void process_del(struct process *process)
Remove process from process list.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct http_response_auth auth
Authorization descriptor.
size_t xfer_window(struct interface *intf)
Check flow control window.
struct http_request_range range
Range descriptor.
void intfs_restart(int rc,...)
Shut down and restart multiple object interfaces.
#define EXDEV
Improper link.
int(* rx)(struct http_transaction *http, struct io_buffer **iobuf)
Receive data.
#define ECANCELED
Operation canceled.
#define ENOTSUP
Operation not supported.
static int http_format_content_type(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Content-Type" header.
Data transfer interfaces.
struct http_request request
Request.
const char * port
Port number.
static struct interface_operation http_content_operations[]
HTTP content-decoded interface operations.
int http_connect(struct interface *xfer, struct uri *uri)
Connect to an HTTP server.
int ssnprintf(char *buf, ssize_t ssize, const char *fmt,...)
Version of vsnprintf() that accepts a signed buffer size.
int(* authenticate)(struct http_transaction *http)
Perform authentication.
struct http_transfer_encoding * encoding
Transfer encoding.
Keep connection alive after close.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
struct http_transfer_encoding http_transfer_chunked __http_transfer_encoding
Chunked transfer encoding.
const char * scheme
Scheme.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
u32 version
Driver version.
struct http_response response
Response.
uint32_t userptr_t
A pointer to a user buffer.
#define __unused
Declare a variable or data structure as unused.
static int http_content_deliver(struct http_transaction *http, struct io_buffer *iobuf, struct xfer_metadata *meta)
Handle received content-decoded data.
static EFI_DEVICE_PATH_PROTOCOL * http_efi_describe(struct http_transaction *http)
Describe as an EFI device path.
static int http_parse_transfer_encoding(struct http_transaction *http, char *line)
Parse HTTP "Transfer-Encoding" header.
Hyper Text Transport Protocol.
static struct interface_operation http_xfer_operations[]
HTTP data transfer interface operations.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
const char * uri
Request URI string.
static int http_parse_content_encoding(struct http_transaction *http, char *line)
Parse HTTP "Content-Encoding" header.
pseudo_bit_t value[0x00020]
static int http_rx_transfer_chunked(struct http_transaction *http, struct io_buffer **iobuf)
Handle received chunked data.
size_t len
Accumulated transfer-decoded length.
#define HTTP_RESPONSE_HEADERS
HTTP response header table.
struct http_request_auth auth
Authentication descriptor.
struct http_response_content content
Content descriptor.
void empty_line_buffer(struct line_buffer *linebuf)
Discard line buffer contents.
size_t len
Length of buffered data.
uint16_t count
Number of entries.
size_t format_uri(const struct uri *uri, char *buf, size_t len)
Format URI.
void pool_reopen(struct interface *intf)
Reopen a defunct connection.
static void profile_start(struct profiler *profiler)
Start profiling.
int http_open_uri(struct interface *xfer, struct uri *uri)
Open HTTP transaction for simple URI.
struct http_request_content content
Content descriptor.
#define EIO_CONTENT_LENGTH
const char * name
Method name (e.g.
struct parameters * params
Request parameters.
HTTP request content descriptor.
int xfer_seek(struct interface *intf, off_t offset)
Seek to position.
void process_add(struct process *process)
Add process to process list.
static __always_inline void struct pci_range * range
static int http_parse_location(struct http_transaction *http, char *line)
Parse HTTP "Location" header.
static struct interface_descriptor http_conn_desc
HTTP server connection interface descriptor.
An object interface descriptor.
struct http_content_encoding * encoding
Content encoding.
#define iob_unput(iobuf, len)
struct http_method http_get
HTTP GET method.
char * strerror(int errno)
Retrieve string representation of error number.
struct http_authentication * auth
Authentication scheme (if any)
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
char * strchr(const char *src, int character)
Find character within a string.
size_t len
Content length (may be zero)
struct interface content
Content-decoded interface.
struct process process
Transmit process.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
struct hv_monitor_parameter param[4][32]
Parameters.
int rc
Return status code.
unsigned int status
Status code.
static struct interface_descriptor http_xfer_desc
HTTP data transfer interface descriptor.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
struct interface transfer
Transfer-decoded interface.
int isspace(int character)
Check to see if character is a space.
struct http_response_header http_response_location __http_response_header
HTTP "Location" header.
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
const char * type
Content type (if any)
size_t strlen(const char *src)
Get length of string.
uint64_t lba
Starting block number.
const char product_version[]
Product version string.
char * buffered_line(struct line_buffer *linebuf)
Retrieve buffered-up line.
struct xfer_buffer * xfer_buffer(struct interface *intf)
Get underlying data transfer buffer.
#define EPROTO_UNSOLICITED
static int http_rx_headers(struct http_transaction *http, struct io_buffer **iobuf)
Handle received HTTP headers.
static int http_parse_retry_after(struct http_transaction *http, char *line)
Parse HTTP "Retry-After" header.
#define HTTP_RETRY_SECONDS
Retry delay used when we cannot understand the Retry-After header.
Data transfer interface opening.
static int http_rx_transfer_identity(struct http_transaction *http, struct io_buffer **iobuf)
Handle received data.
char * http_token(char **line, char **value)
Get HTTP response token.
#define HTTP_TRANSFER_ENCODINGS
HTTP transfer encoding table.
#define EINVAL_CONTENT_LENGTH
struct line_buffer headers
Raw response header lines.
static int http_format_host(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Host" header.
const char * host
Host name.
struct retry_timer timer
Reconnection timer.
#define PARAMETER_FORM
Request parameter is a form parameter.
static int http_format_content_length(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Content-Length" header.
static size_t http_form_params(struct parameters *params, char *buf, size_t len)
Construct HTTP form parameter list.
const void * data
Content data (if any)
static int http_init_transfer_chunked(struct http_transaction *http)
Initialise transfer encoding.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
size_t len
Range length, or zero for no range request.
size_t len
Content length.
static void http_close_transfer_identity(struct http_transaction *http, int rc)
Handle server connection close.
struct http_response_transfer transfer
Transfer descriptor.
#define EINVAL_CHUNK_LENGTH
static int http_rx_chunk_len(struct http_transaction *http, struct io_buffer **iobuf)
Handle received chunk length.
void stop_timer(struct retry_timer *timer)
Stop timer.
static struct process_descriptor http_process_desc
HTTP process descriptor.
EFI_DEVICE_PATH_PROTOCOL * efi_describe(struct interface *intf)
Describe object as an EFI device path.
static int http_transfer_complete(struct http_transaction *http)
Handle successful transfer completion.
#define HTTP_REQUEST_HEADERS
HTTP request header table.
struct http_authentication * auth
Authentication scheme (if any)
int http_open(struct interface *xfer, struct http_method *method, struct uri *uri, struct http_request_range *range, struct http_request_content *content)
Open HTTP transaction.
void * data
Start of data.
static int http_parse_status(struct http_transaction *http, char *line)
Parse HTTP status line.
static void http_close_error(struct http_transaction *http, int rc)
Close HTTP transaction with error (even if none specified)
struct refcnt refcnt
Reference count.
struct ena_aq_header header
Header.
struct http_method * method
Method.
static void http_reopen(struct http_transaction *http)
Reopen stale HTTP connection.
static struct interface_operation http_transfer_operations[]
HTTP transfer-decoded interface operations.
uint8_t data[48]
Additional event data.
static int http_init_transfer_identity(struct http_transaction *http)
Initialise transfer encoding.
const char * name
Name (e.g.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const char * epath
Path (with original URI encoding)
#define __weak
Declare a function as weak (use before the definition)
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
size_t remaining
Chunk length remaining.
A Uniform Resource Identifier.
Transaction may be retried on failure.
#define INTF_DESC_PASSTHRU(object_type, intf, operations, passthru)
Define an object interface descriptor with pass-through interface.
static void http_free(struct refcnt *refcnt)
Free HTTP transaction.
int line_buffer(struct line_buffer *linebuf, const char *data, size_t len)
Buffer up received data by lines.
__weak int http_block_read(struct http_transaction *http __unused, struct interface *data __unused, uint64_t lba __unused, unsigned int count __unused, userptr_t buffer __unused, size_t len __unused)
Read from block device (when HTTP block device support is not present)
struct uri * resolve_uri(const struct uri *base_uri, struct uri *relative_uri)
Resolve base+relative URI.
static struct http_state http_headers
HTTP response headers state.
static struct http_state http_request
HTTP request state.
static void http_step(struct http_transaction *http)
HTTP transmit process.
int(* init)(struct http_transaction *http)
Initialise transfer encoding.
void pool_recycle(struct interface *intf)
Recycle this connection after closing.
int block_read_capacity(struct interface *control, struct interface *data)
Read block device capacity.
int(* supported)(struct http_transaction *http)
Check if content encoding is supported for this request.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
struct http_state state
Receive data state.
An HTTP transfer encoding.
static int http_format_headers(struct http_transaction *http, char *buf, size_t len)
Construct HTTP request headers.
static int http_rx_linebuf(struct http_transaction *http, struct io_buffer *iobuf, struct line_buffer *linebuf)
Handle received HTTP line-buffered data.
static int http_rx_chunk_data(struct http_transaction *http, struct io_buffer **iobuf)
Handle received chunk data.
static int http_format_range(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Range" header.
#define NULL
NULL pointer (VOID *)
#define PARAMETER_HEADER
Request parameter is a header parameter.
struct http_method http_post
HTTP POST method.
int(* init)(struct http_transaction *http)
Initialise content encoding.
unsigned int retry_after
Retry delay (in seconds)
static int http_format_accept_encoding(struct http_transaction *http, char *buf, size_t len)
Construct HTTP "Accept-Encoding" header.
struct errortab http_errors [] __errortab
Human-readable error messages.
#define ref_put(refcnt)
Drop reference to object.
static int http_parse_content_length(struct http_transaction *http, char *line)
Parse HTTP "Content-Length" header.
struct uri * parse_uri(const char *uri_string)
Parse URI.
static int http_format_user_agent(struct http_transaction *http __unused, char *buf, size_t len)
Construct HTTP "User-Agent" header.
void * memset(void *dest, int character, size_t len) __nonnull
static struct http_state http_trailers
HTTP response trailers state.
static void http_conn_close(struct http_transaction *http, int rc)
Handle server connection close.
#define HTTP_CONTENT_ENCODINGS
HTTP content encoding table.
int xfer_redirect(struct interface *intf, int type,...)
Send redirection event.