Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
641173c
WIP
bretambrose Jun 7, 2020
7f5e43e
Initial version; missing endpoint for live integration test
bretambrose Jun 7, 2020
a156ede
Double tls theoretical support; need a test case
bretambrose Jun 8, 2020
9c867cc
Merge branch 'main' into ProxyTunnel
bretambrose Dec 2, 2020
093c2f4
Proxy request flow interface/contract
bretambrose Dec 2, 2020
14ca5bd
Doc addition
bretambrose Dec 2, 2020
2827688
More doc updates
bretambrose Dec 2, 2020
eb5db2f
Passing original tests
bretambrose Dec 14, 2020
4f6d0e3
resolver creation
bretambrose Dec 14, 2020
eefa7c3
Merge branch 'main' into ProxyRequestFlow
bretambrose Dec 14, 2020
312d061
Validate mistake
bretambrose Dec 14, 2020
9542770
Undo incorrect fix
bretambrose Dec 14, 2020
441c0ae
connect http response callbacks invoke proxy strategy callbacks
bretambrose Dec 14, 2020
e7dd6b1
Experimental proxy strategy
bretambrose Dec 14, 2020
36e2103
Stick with generic strategy types in chain callbacks
bretambrose Dec 14, 2020
35baf67
Incorrect user data
bretambrose Dec 14, 2020
5372464
Window fix
bretambrose Dec 14, 2020
21cbe54
Iterate connect attempts until strategy explicitly gives up
bretambrose Dec 14, 2020
f09633e
Error code fixes on proxy strategy loop and termination
bretambrose Dec 14, 2020
82a528f
Stubbed adaptive kerberos support
bretambrose Dec 14, 2020
0a7bf93
Disable windows warning
bretambrose Dec 15, 2020
444f4f3
Propagate proxy connection type
bretambrose Jan 7, 2021
fe2c27c
Merge branch 'ProxyRequestFlow' of github.com:awslabs/aws-c-http into…
bretambrose Jan 7, 2021
3143a50
WIP
bretambrose Jan 13, 2021
6e91411
Merge branch 'main' into ProxyRequestFlow
bretambrose Jan 13, 2021
9916a92
Backwards compat prep; type cast fix
bretambrose Jan 14, 2021
ac1f02a
Nested tls integration test
bretambrose Jan 19, 2021
170778b
add code for kerberos strategy with user token as input(straight) & m…
ajainaus Jan 20, 2021
50bf433
First pass on sync kerberos/ntlm strategy api refactor
bretambrose Jan 21, 2021
d4a738d
Proxy strategy rename fest
bretambrose Jan 21, 2021
7208ae9
Proxy request flow merge (#302)
bretambrose Jan 21, 2021
b139f3e
Kerberos happy path test; proxy tester updates
bretambrose Jan 22, 2021
c186df8
Merge branch 'ProxyRequestFlow' of github.com:awslabs/aws-c-http into…
bretambrose Jan 22, 2021
42f3493
kerberos failure tests
bretambrose Jan 22, 2021
a26ff59
Adaptive proxy strategy tests
bretambrose Jan 22, 2021
d7c829a
Update token retrieval function signatures to handle persistence prop…
bretambrose Jan 24, 2021
6d9d4ae
User token retrieval error code
bretambrose Jan 24, 2021
c6825dc
First attempt at iterating connections per CONNECT attempt with proxies
bretambrose Jan 28, 2021
9014f90
Basic failure sequence testing
bretambrose Jan 28, 2021
d441a2d
Use full adapative in failure test
bretambrose Jan 28, 2021
c042ee1
Proxy request flow no one time strategy (#303)
ajainaus Jan 28, 2021
1d9ff1d
Restore identity in prep for sequence merge
bretambrose Jan 28, 2021
5690c96
Merge of sequential proxy strategy flow
bretambrose Jan 28, 2021
ca9ea62
Updates and fixes, real retry loop
bretambrose Jan 28, 2021
1bdee3e
Allow proxy sequence strategy to dynamically choose whether or not to…
bretambrose Jan 29, 2021
034d137
Clear error code before attempting anoter CONNECT on a persistent con…
bretambrose Jan 29, 2021
ffabc43
Wipe previous connect request before attempting a new one on the same…
bretambrose Jan 29, 2021
2169056
Windows warning fix
bretambrose Jan 29, 2021
63b3ac5
Merge branch 'main' into ProxyRequestFlow
bretambrose Feb 19, 2021
d789f31
Empty change
bretambrose Feb 19, 2021
96034e0
Merge branch 'ProxyRequestFlow' of github.com:awslabs/aws-c-http into…
bretambrose Feb 19, 2021
200c575
Legacy backwards compatibility
bretambrose Feb 20, 2021
58f8be7
Override proxy type when using legacy basic authentication
bretambrose Feb 24, 2021
910846e
Refactor proxy config/options in anticipation of mqtt refactor
bretambrose Mar 1, 2021
55f3620
Format
bretambrose Mar 1, 2021
de9b506
Documentation
bretambrose Mar 1, 2021
4a7da73
Placeholder for raw channel creation through an http proxy
bretambrose Mar 1, 2021
fd4a1a4
Windows fixes to trigger clang CI
bretambrose Mar 11, 2021
3cd4f13
Merge branch 'main' into Proxyv2
bretambrose Mar 11, 2021
1f9e53d
correct include guard
bretambrose Mar 22, 2021
1852241
Reenable and fix adaptive proxy negotiation unit tests
bretambrose Mar 23, 2021
e5431c4
Test fixes
bretambrose Mar 23, 2021
0ca610f
Documentation and invariants
bretambrose Mar 23, 2021
ce17e7d
Merge branch 'main' into Proxyv2
bretambrose Mar 23, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 6 additions & 48 deletions include/aws/http/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,54 +121,6 @@ struct aws_http_connection_monitoring_options {
uint32_t allowable_throughput_failure_interval_seconds;
};

/**
* Supported proxy authentication modes
*/
enum aws_http_proxy_authentication_type {
AWS_HPAT_NONE = 0,
AWS_HPAT_BASIC,
};

/**
* Options for http proxy server usage
*/
struct aws_http_proxy_options {

/**
* Proxy host to connect to, in lieu of actual target
*/
struct aws_byte_cursor host;

/**
* Port to make the proxy connection to
*/
uint16_t port;

/**
* Optional.
* TLS configuration for the Local <-> Proxy connection
* Must be distinct from the the TLS options in the parent aws_http_connection_options struct
*/
const struct aws_tls_connection_options *tls_options;

/**
* What type of proxy authentication to use, if any
*/
enum aws_http_proxy_authentication_type auth_type;

/**
* Optional
* User name to use for authentication, basic only
*/
struct aws_byte_cursor auth_username;

/**
* Optional
* Password to use for authentication, basic only
*/
struct aws_byte_cursor auth_password;
};

/**
* Options specific to HTTP/1.x connections.
* Initialize with AWS_HTTP1_CONNECTION_OPTIONS_INIT to set default values.
Expand Down Expand Up @@ -482,6 +434,12 @@ enum aws_http_version aws_http_connection_get_version(const struct aws_http_conn
AWS_HTTP_API
struct aws_channel *aws_http_connection_get_channel(struct aws_http_connection *connection);

/**
* Checks http proxy options for correctness
*/
AWS_HTTP_API
int aws_http_options_validate_proxy_configuration(const struct aws_http_client_connection_options *options);

/**
* Send a SETTINGS frame (HTTP/2 only).
* SETTINGS will be applied locally when SETTINGS ACK is received from peer.
Expand Down
6 changes: 5 additions & 1 deletion include/aws/http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum aws_http_errors {
AWS_ERROR_HTTP_CONNECTION_MANAGER_INVALID_STATE_FOR_ACQUIRE,
AWS_ERROR_HTTP_CONNECTION_MANAGER_VENDED_CONNECTION_UNDERFLOW,
AWS_ERROR_HTTP_SERVER_CLOSED,
AWS_ERROR_HTTP_PROXY_TLS_CONNECT_FAILED,
AWS_ERROR_HTTP_PROXY_CONNECT_FAILED,
AWS_ERROR_HTTP_CONNECTION_MANAGER_SHUTTING_DOWN,
AWS_ERROR_HTTP_CHANNEL_THROUGHPUT_FAILURE,
AWS_ERROR_HTTP_PROTOCOL_ERROR,
Expand All @@ -46,6 +46,9 @@ enum aws_http_errors {
AWS_ERROR_HTTP_RST_STREAM_SENT,
AWS_ERROR_HTTP_STREAM_NOT_ACTIVATED,
AWS_ERROR_HTTP_STREAM_HAS_COMPLETED,
AWS_ERROR_HTTP_PROXY_STRATEGY_NTLM_CHALLENGE_TOKEN_MISSING,
AWS_ERROR_HTTP_PROXY_STRATEGY_TOKEN_RETRIEVAL_FAILURE,
AWS_ERROR_HTTP_PROXY_CONNECT_FAILED_RETRYABLE,

AWS_ERROR_HTTP_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_HTTP_PACKAGE_ID)
};
Expand Down Expand Up @@ -79,6 +82,7 @@ enum aws_http_log_subject {
AWS_LS_HTTP_CONNECTION_MANAGER,
AWS_LS_HTTP_WEBSOCKET,
AWS_LS_HTTP_WEBSOCKET_SETUP,
AWS_LS_HTTP_PROXY_NEGOTIATION,
};

enum aws_http_version {
Expand Down
104 changes: 93 additions & 11 deletions include/aws/http/private/proxy_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@
#include <aws/http/http.h>

#include <aws/http/connection.h>
#include <aws/http/proxy.h>
#include <aws/http/status_code.h>
#include <aws/io/socket.h>

struct aws_http_connection_manager_options;
struct aws_http_message;
struct aws_channel_slot;
struct aws_string;
struct aws_tls_connection_options;
struct aws_http_proxy_negotiator;
struct aws_http_proxy_strategy;
struct aws_http_proxy_strategy_tunneling_sequence_options;
struct aws_http_proxy_strategy_tunneling_kerberos_options;
struct aws_http_proxy_strategy_tunneling_ntlm_options;

/*
* (Successful) State transitions for proxy connections
Expand All @@ -37,17 +46,15 @@ struct aws_http_proxy_config {

struct aws_allocator *allocator;

enum aws_http_proxy_connection_type connection_type;

struct aws_byte_buf host;

uint16_t port;

struct aws_tls_connection_options *tls_options;

enum aws_http_proxy_authentication_type auth_type;

struct aws_byte_buf auth_username;

struct aws_byte_buf auth_password;
struct aws_http_proxy_strategy *proxy_strategy;
};

/*
Expand All @@ -61,19 +68,31 @@ struct aws_http_proxy_config {
struct aws_http_proxy_user_data {
struct aws_allocator *allocator;

/*
* dynamic proxy connection resolution state
*/
enum aws_proxy_bootstrap_state state;
int error_code;
enum aws_http_status_code connect_status_code;
struct aws_http_connection *connection;
struct aws_http_message *connect_request;
struct aws_http_stream *connect_stream;
struct aws_http_proxy_negotiator *proxy_negotiator;

/*
* Cached original connect options
*/
struct aws_string *original_host;
uint16_t original_port;
aws_http_on_client_connection_setup_fn *original_on_setup;
aws_http_on_client_connection_shutdown_fn *original_on_shutdown;
void *original_user_data;

struct aws_tls_connection_options *tls_options;
struct aws_client_bootstrap *bootstrap;
struct aws_socket_options socket_options;
bool manual_window_management;
size_t initial_window_size;

struct aws_http_proxy_config *proxy_config;
};
Expand Down Expand Up @@ -103,18 +122,81 @@ int aws_http_rewrite_uri_for_proxy_request(
AWS_HTTP_API
void aws_http_proxy_system_set_vtable(struct aws_http_proxy_system_vtable *vtable);

/**
* Checks if tunneling proxy negotiation should continue to try and connect
* @param proxy_negotiator negotiator to query
* @return true if another connect request should be attempted, false otherwise
*/
AWS_HTTP_API
enum aws_http_proxy_negotiation_retry_directive aws_http_proxy_negotiator_get_retry_directive(
struct aws_http_proxy_negotiator *proxy_negotiator);

/**
* Constructor for a tunnel-only proxy strategy that applies no changes to outbound CONNECT requests. Intended to be
* the first link in an adaptive sequence for a tunneling proxy: first try a basic CONNECT, then based on the response,
* later links are allowed to make attempts.
*
* @param allocator memory allocator to use
* @return a new proxy strategy if successfully constructed, otherwise NULL
*/
AWS_HTTP_API
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_one_time_identity(
struct aws_allocator *allocator);

/**
* Constructor for a forwarding-only proxy strategy that does nothing. Exists so that all proxy logic uses a
* strategy.
*
* @param allocator memory allocator to use
* @return a new proxy strategy if successfully constructed, otherwise NULL
*/
AWS_HTTP_API
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_forwarding_identity(struct aws_allocator *allocator);

/**
* Constructor for a tunneling proxy strategy that contains a set of sub-strategies which are tried
* sequentially in order. Each strategy has the choice to either proceed on a fresh connection or
* reuse the current one.
*
* @param allocator memory allocator to use
* @param config sequence configuration options
* @return a new proxy strategy if successfully constructed, otherwise NULL
*/
AWS_HTTP_API
struct aws_http_proxy_config *aws_http_proxy_config_new(
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_sequence(
struct aws_allocator *allocator,
const struct aws_http_proxy_options *options);
struct aws_http_proxy_strategy_tunneling_sequence_options *config);

/**
* A constructor for a proxy strategy that performs kerberos authentication by adding the appropriate
* header and header value to CONNECT requests.
*
* Currently only supports synchronous fetch of kerberos token values.
*
* @param allocator memory allocator to use
* @param config kerberos authentication configuration info
* @return a new proxy strategy if successfully constructed, otherwise NULL
*/
AWS_HTTP_API
void aws_http_proxy_config_destroy(struct aws_http_proxy_config *config);
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_kerberos(
struct aws_allocator *allocator,
struct aws_http_proxy_strategy_tunneling_kerberos_options *config);

/**
* Constructor for an NTLM proxy strategy. Because ntlm is a challenge-response authentication protocol, this
* strategy will only succeed in a chain in a non-leading position. The strategy extracts the challenge from the
* proxy's response to a previous CONNECT request in the chain.
*
* Currently only supports synchronous fetch of token values.
*
* @param allocator memory allocator to use
* @param config configuration options for the strategy
* @return a new proxy strategy if successfully constructed, otherwise NULL
*/
AWS_HTTP_API
void aws_http_proxy_options_init_from_config(
struct aws_http_proxy_options *options,
const struct aws_http_proxy_config *config);
struct aws_http_proxy_strategy *aws_http_proxy_strategy_new_tunneling_ntlm(
struct aws_allocator *allocator,
struct aws_http_proxy_strategy_tunneling_ntlm_options *config);

AWS_EXTERN_C_END

Expand Down
Loading