Skip to content

Commit 9d67050

Browse files
authored
rename aws_utf8_validator -> aws_utf8_decoder (#422)
Adapt to: awslabs/aws-c-common#981
1 parent 0c79a1c commit 9d67050

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/aws/http/private/websocket_decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct aws_websocket_decoder {
4242
/* True while processing a TEXT "message" (from the start of a TEXT frame,
4343
* until the end of the TEXT or CONTINUATION frame with the FIN bit set). */
4444
bool processing_text_message;
45-
struct aws_utf8_validator *text_message_validator;
45+
struct aws_utf8_decoder *text_message_validator;
4646

4747
void *user_data;
4848
aws_websocket_decoder_frame_fn *on_frame;

source/websocket_decoder.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static int s_state_payload(struct aws_websocket_decoder *decoder, struct aws_byt
276276

277277
/* Validate the UTF-8 for TEXT messages (a TEXT frame and any subsequent CONTINUATION frames) */
278278
if (decoder->processing_text_message && aws_websocket_is_data_frame(decoder->current_frame.opcode)) {
279-
if (aws_utf8_validator_update(decoder->text_message_validator, payload)) {
279+
if (aws_utf8_decoder_update(decoder->text_message_validator, payload)) {
280280
AWS_LOGF_ERROR(AWS_LS_HTTP_WEBSOCKET, "id=%p: Received invalid UTF-8", (void *)decoder->user_data);
281281
return aws_raise_error(AWS_ERROR_HTTP_WEBSOCKET_PROTOCOL_ERROR);
282282
}
@@ -308,7 +308,7 @@ static int s_state_frame_end(struct aws_websocket_decoder *decoder, struct aws_b
308308
if (decoder->processing_text_message && aws_websocket_is_data_frame(decoder->current_frame.opcode) &&
309309
decoder->current_frame.fin) {
310310

311-
if (aws_utf8_validator_finalize(decoder->text_message_validator)) {
311+
if (aws_utf8_decoder_finalize(decoder->text_message_validator)) {
312312
AWS_LOGF_ERROR(
313313
AWS_LS_HTTP_WEBSOCKET,
314314
"id=%p: Received invalid UTF-8 (incomplete encoding)",
@@ -378,10 +378,10 @@ void aws_websocket_decoder_init(
378378
decoder->user_data = user_data;
379379
decoder->on_frame = on_frame;
380380
decoder->on_payload = on_payload;
381-
decoder->text_message_validator = aws_utf8_validator_new(alloc);
381+
decoder->text_message_validator = aws_utf8_decoder_new(alloc, NULL /*options*/);
382382
}
383383

384384
void aws_websocket_decoder_clean_up(struct aws_websocket_decoder *decoder) {
385-
aws_utf8_validator_destroy(decoder->text_message_validator);
385+
aws_utf8_decoder_destroy(decoder->text_message_validator);
386386
AWS_ZERO_STRUCT(*decoder);
387387
}

0 commit comments

Comments
 (0)