Skip to content

Commit 5ac6b82

Browse files
committed
use aws_http_headers_get_single() instead of just get()
1 parent f794b5f commit 5ac6b82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/websocket_bootstrap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ int aws_websocket_client_connect(const struct aws_websocket_client_connection_op
144144

145145
const struct aws_http_headers *request_headers = aws_http_message_get_headers(options->handshake_request);
146146
struct aws_byte_cursor sec_websocket_key;
147-
if (aws_http_headers_get(request_headers, aws_byte_cursor_from_c_str("Sec-WebSocket-Key"), &sec_websocket_key)) {
147+
if (aws_http_headers_get_single(
148+
request_headers, aws_byte_cursor_from_c_str("Sec-WebSocket-Key"), &sec_websocket_key)) {
148149
AWS_LOGF_ERROR(
149150
AWS_LS_HTTP_WEBSOCKET_SETUP,
150151
"id=static: Websocket handshake request is missing required 'Sec-WebSocket-Key' header");
@@ -540,7 +541,7 @@ static int s_ws_bootstrap_validate_header(
540541
bool case_sensitive) {
541542

542543
struct aws_byte_cursor actual_value;
543-
if (aws_http_headers_get(ws_bootstrap->response_headers, aws_byte_cursor_from_c_str(name), &actual_value)) {
544+
if (aws_http_headers_get_single(ws_bootstrap->response_headers, aws_byte_cursor_from_c_str(name), &actual_value)) {
544545
AWS_LOGF_ERROR(
545546
AWS_LS_HTTP_WEBSOCKET_SETUP, "id=%p: Response lacks required '%s' header", (void *)ws_bootstrap, name);
546547
return aws_raise_error(AWS_ERROR_HTTP_WEBSOCKET_UPGRADE_FAILURE);

0 commit comments

Comments
 (0)