Skip to content

Commit 9e78803

Browse files
committed
trivial
1 parent 74e7aa2 commit 9e78803

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

source/websocket_bootstrap.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ struct aws_websocket_client_bootstrap {
7474
* this is what we expect the response's "Sec-WebSocket-Accept" to be */
7575
struct aws_byte_buf expected_sec_websocket_accept;
7676

77-
/* Values from the request's "Sec-WebSocket-Protocol" values (or NULL if none) */
78-
struct aws_string *expected_sec_websocket_protocol;
77+
/* Comma-separated values from the request's "Sec-WebSocket-Protocol" (or NULL if none) */
78+
struct aws_string *expected_sec_websocket_protocols;
7979

8080
/* Handshake response data */
8181
int response_status;
@@ -186,7 +186,7 @@ int aws_websocket_client_connect(const struct aws_websocket_client_connection_op
186186
goto error;
187187
}
188188

189-
ws_bootstrap->expected_sec_websocket_protocol =
189+
ws_bootstrap->expected_sec_websocket_protocols =
190190
aws_http_headers_get_all(request_headers, aws_byte_cursor_from_c_str("Sec-WebSocket-Protocol"));
191191

192192
/* Initiate HTTP connection */
@@ -255,7 +255,7 @@ static void s_ws_bootstrap_destroy(struct aws_websocket_client_bootstrap *ws_boo
255255
aws_http_message_release(ws_bootstrap->handshake_request);
256256
aws_http_headers_release(ws_bootstrap->response_headers);
257257
aws_byte_buf_clean_up(&ws_bootstrap->expected_sec_websocket_accept);
258-
aws_string_destroy(ws_bootstrap->expected_sec_websocket_protocol);
258+
aws_string_destroy(ws_bootstrap->expected_sec_websocket_protocols);
259259
aws_byte_buf_clean_up(&ws_bootstrap->response_body);
260260

261261
aws_mem_release(ws_bootstrap->alloc, ws_bootstrap);
@@ -600,7 +600,7 @@ static int s_ws_bootstrap_validate_header(
600600
static int s_ws_bootstrap_validate_sec_websocket_protocol(const struct aws_websocket_client_bootstrap *ws_bootstrap) {
601601
/* First handle the easy case:
602602
* If client requested no protocols, then the response should not pick any */
603-
if (ws_bootstrap->expected_sec_websocket_protocol == NULL) {
603+
if (ws_bootstrap->expected_sec_websocket_protocols == NULL) {
604604
if (aws_http_headers_has(
605605
ws_bootstrap->response_headers, aws_byte_cursor_from_c_str("Sec-WebSocket-Protocol"))) {
606606

@@ -625,11 +625,11 @@ static int s_ws_bootstrap_validate_sec_websocket_protocol(const struct aws_webso
625625
return aws_raise_error(AWS_ERROR_HTTP_WEBSOCKET_UPGRADE_FAILURE);
626626
}
627627

628-
struct aws_byte_cursor expected_sec_websocket_protocol =
629-
aws_byte_cursor_from_string(ws_bootstrap->expected_sec_websocket_protocol);
628+
struct aws_byte_cursor request_protocols =
629+
aws_byte_cursor_from_string(ws_bootstrap->expected_sec_websocket_protocols);
630630
struct aws_byte_cursor request_protocol_i;
631631
AWS_ZERO_STRUCT(request_protocol_i);
632-
while (aws_byte_cursor_next_split(&expected_sec_websocket_protocol, ',', &request_protocol_i)) {
632+
while (aws_byte_cursor_next_split(&request_protocols, ',', &request_protocol_i)) {
633633
struct aws_byte_cursor request_protocol = aws_strutil_trim_http_whitespace(request_protocol_i);
634634
if (aws_byte_cursor_eq(&response_protocol, &request_protocol)) {
635635
/* Success! */
@@ -648,7 +648,7 @@ static int s_ws_bootstrap_validate_sec_websocket_protocol(const struct aws_webso
648648
"'. Expected one of '" PRInSTR "'",
649649
(void *)ws_bootstrap,
650650
AWS_BYTE_CURSOR_PRI(response_protocol),
651-
AWS_BYTE_CURSOR_PRI(expected_sec_websocket_protocol));
651+
AWS_BYTE_CURSOR_PRI(request_protocols));
652652
return aws_raise_error(AWS_ERROR_HTTP_WEBSOCKET_UPGRADE_FAILURE);
653653
}
654654

0 commit comments

Comments
 (0)