diff options
author | Michael Brown <mcb30@ipxe.org> | 2020-12-08 14:55:44 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2020-12-08 15:04:28 +0000 |
commit | be47c2c72cd3cdecc146eca5a200d454643bcf06 (patch) | |
tree | d9f42086d3bb7048f06bbb0da6e03a4ebc6e6ee8 /src/net/tcp | |
parent | 1b112e9d18bb9c874b87ce5feabb7906f62351b3 (diff) | |
download | ipxe-be47c2c72cd3cdecc146eca5a200d454643bcf06.tar.gz |
[http] Hide HTTP transport-layer filter implementation details
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp')
-rw-r--r-- | src/net/tcp/httpconn.c | 3 | ||||
-rw-r--r-- | src/net/tcp/https.c | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/net/tcp/httpconn.c b/src/net/tcp/httpconn.c index 2804e09d5..f9221b27e 100644 --- a/src/net/tcp/httpconn.c +++ b/src/net/tcp/httpconn.c @@ -301,8 +301,7 @@ int http_connect ( struct interface *xfer, struct uri *uri ) { goto err_open; /* Add filter, if any */ - if ( scheme->filter && - ( ( rc = scheme->filter ( &conn->socket, uri->host ) ) != 0 ) ) + if ( scheme->filter && ( ( rc = scheme->filter ( conn ) ) != 0 ) ) goto err_filter; /* Attach to parent interface, mortalise self, and return */ diff --git a/src/net/tcp/https.c b/src/net/tcp/https.c index e91000322..5a44bdebf 100644 --- a/src/net/tcp/https.c +++ b/src/net/tcp/https.c @@ -31,12 +31,24 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); */ #include <ipxe/open.h> +#include <ipxe/uri.h> #include <ipxe/tls.h> #include <ipxe/http.h> #include <ipxe/features.h> FEATURE ( FEATURE_PROTOCOL, "HTTPS", DHCP_EB_FEATURE_HTTPS, 1 ); +/** + * Add HTTPS filter + * + * @v conn HTTP connection + * @ret rc Return status code + */ +static int https_filter ( struct http_connection *conn ) { + + return add_tls ( &conn->socket, conn->uri->host ); +} + /** HTTPS URI opener */ struct uri_opener https_uri_opener __uri_opener = { .scheme = "https", @@ -47,5 +59,5 @@ struct uri_opener https_uri_opener __uri_opener = { struct http_scheme https_scheme __http_scheme = { .name = "https", .port = HTTPS_PORT, - .filter = add_tls, + .filter = https_filter, }; |