iPXE
|
Hyper Text Transfer Protocol (HTTP) connection management. More...
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/tcpip.h>
#include <ipxe/uri.h>
#include <ipxe/timer.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/pool.h>
#include <ipxe/http.h>
Go to the source code of this file.
Macros | |
#define | HTTP_CONN_EXPIRY ( 10 * TICKS_PER_SEC ) |
HTTP pooled connection expiry time. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | LIST_HEAD (http_connection_pool) |
HTTP connection pool. More... | |
static struct http_scheme * | http_scheme (struct uri *uri) |
Identify HTTP scheme. More... | |
static void | http_conn_free (struct refcnt *refcnt) |
Free HTTP connection. More... | |
static void | http_conn_close (struct http_connection *conn, int rc) |
Close HTTP connection. More... | |
static void | http_conn_expired (struct pooled_connection *pool) |
Disconnect idle HTTP connection. More... | |
static int | http_conn_socket_deliver (struct http_connection *conn, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Receive data from transport layer interface. More... | |
static void | http_conn_socket_close (struct http_connection *conn, int rc) |
Close HTTP connection transport layer interface. More... | |
static void | http_conn_xfer_recycle (struct http_connection *conn) |
Recycle this connection after closing. More... | |
static void | http_conn_xfer_close (struct http_connection *conn, int rc) |
Close HTTP connection data transfer interface. More... | |
int | http_connect (struct interface *xfer, struct uri *uri) |
Connect to an HTTP server. More... | |
Variables | |
static struct interface_operation | http_conn_socket_operations [] |
HTTP connection socket interface operations. More... | |
static struct interface_descriptor | http_conn_socket_desc |
HTTP connection socket interface descriptor. More... | |
static struct interface_operation | http_conn_xfer_operations [] |
HTTP connection data transfer interface operations. More... | |
static struct interface_descriptor | http_conn_xfer_desc |
HTTP connection data transfer interface descriptor. More... | |
Hyper Text Transfer Protocol (HTTP) connection management.
Definition in file httpconn.c.
#define HTTP_CONN_EXPIRY ( 10 * TICKS_PER_SEC ) |
HTTP pooled connection expiry time.
Definition at line 47 of file httpconn.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
HTTP connection pool.
|
static |
Identify HTTP scheme.
uri | URI |
scheme | HTTP scheme, or NULL |
Definition at line 58 of file httpconn.c.
References for_each_table_entry, HTTP_SCHEMES, http_scheme::name, NULL, uri::scheme, and strcasecmp().
Referenced by http_connect().
|
static |
Free HTTP connection.
refcnt | Reference count |
Definition at line 79 of file httpconn.c.
References container_of, free, http_connection::uri, and uri_put().
Referenced by http_connect().
|
static |
Close HTTP connection.
conn | HTTP connection |
rc | Reason for close |
Definition at line 94 of file httpconn.c.
References DBGC, DBGC2, uri::host, intf_shutdown(), http_scheme::name, http_connection::pool, pool_del(), rc, http_connection::scheme, http_connection::socket, strerror(), http_connection::uri, and http_connection::xfer.
Referenced by http_conn_expired(), http_conn_socket_close(), http_conn_xfer_close(), and http_connect().
|
static |
Disconnect idle HTTP connection.
pool | Pooled connection |
Definition at line 117 of file httpconn.c.
References container_of, http_conn_close(), and pool.
Referenced by http_connect().
|
static |
Receive data from transport layer interface.
http | HTTP connection |
iobuf | I/O buffer |
meta | Transfer metadata |
rc | Return status code |
Definition at line 133 of file httpconn.c.
References meta(), http_connection::pool, http_connection::xfer, and xfer_deliver().
|
static |
Close HTTP connection transport layer interface.
http | HTTP connection |
rc | Reason for close |
Definition at line 150 of file httpconn.c.
References http_conn_close(), http_connection::pool, pool_reopen(), rc, and http_connection::xfer.
|
static |
Recycle this connection after closing.
http | HTTP connection |
Definition at line 169 of file httpconn.c.
References DBGC2, and http_connection::pool.
|
static |
Close HTTP connection data transfer interface.
conn | HTTP connection |
rc | Reason for close |
Definition at line 182 of file httpconn.c.
References DBGC2, uri::host, http_conn_close(), HTTP_CONN_EXPIRY, intf_restart(), http_scheme::name, http_connection::pool, pool_add(), rc, http_connection::scheme, http_connection::uri, and http_connection::xfer.
Connect to an HTTP server.
xfer | Data transfer interface |
uri | Connection URI |
rc | Return status code |
HTTP connections are pooled. The caller should be prepared to receive a pool_reopen() message.
Definition at line 236 of file httpconn.c.
References assert(), DBGC2, EINVAL, ENOMEM, ENOTSUP, http_scheme::filter, uri::host, htons, http_conn_close(), http_conn_expired(), http_conn_free(), http_conn_socket_desc, http_conn_xfer_desc, http_scheme(), intf_init(), intf_plug_plug(), list_for_each_entry_reverse, memset(), http_scheme::name, NULL, pool, http_connection::pool, pool_del(), port, http_scheme::port, rc, ref_init, ref_put, http_connection::refcnt, http_connection::scheme, SOCK_STREAM, http_connection::socket, sockaddr_tcpip::st_port, strcmp(), strerror(), http_connection::uri, uri_get(), uri_port(), http_connection::xfer, xfer_open_named_socket(), and zalloc().
Referenced by http_open(), and http_reopen().
|
static |
HTTP connection socket interface operations.
Definition at line 201 of file httpconn.c.
|
static |
HTTP connection socket interface descriptor.
Definition at line 209 of file httpconn.c.
Referenced by http_connect().
|
static |
HTTP connection data transfer interface operations.
Definition at line 214 of file httpconn.c.
|
static |
HTTP connection data transfer interface descriptor.
Definition at line 222 of file httpconn.c.
Referenced by http_connect().