Skip to content

Commit

Permalink
fix(esp_http_server): updated condition to verify http version
Browse files Browse the repository at this point in the history
Closes #14723
  • Loading branch information
nileshkale123 committed Nov 4, 2024
1 parent 98618d7 commit 779ac50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/esp_http_server/src/httpd_parse.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -90,7 +90,7 @@ static esp_err_t verify_url (http_parser *parser)
ESP_LOGD(TAG, LOG_FMT("received URI = %s"), r->uri);

/* Make sure version is HTTP/1.1 */
if ((parser->http_major != 1) && (parser->http_minor != 1)) {
if (!((parser->http_major == 1) && (parser->http_minor == 1))) {
ESP_LOGW(TAG, LOG_FMT("unsupported HTTP version = %d.%d"),
parser->http_major, parser->http_minor);
parser_data->error = HTTPD_505_VERSION_NOT_SUPPORTED;
Expand All @@ -110,7 +110,7 @@ static esp_err_t verify_url (http_parser *parser)
}

/* http_parser callback on finding url in HTTP request
* Will be invoked ATLEAST once every packet
* Will be invoked AT LEAST once every packet
*/
static esp_err_t cb_url(http_parser *parser,
const char *at, size_t length)
Expand Down Expand Up @@ -195,7 +195,7 @@ static size_t continue_parsing(http_parser *parser, size_t length)
}

/* http_parser callback on header field in HTTP request
* May be invoked ATLEAST once every header field
* May be invoked AT LEAST once every header field
*/
static esp_err_t cb_header_field(http_parser *parser, const char *at, size_t length)
{
Expand Down Expand Up @@ -254,7 +254,7 @@ static esp_err_t cb_header_field(http_parser *parser, const char *at, size_t len
}

/* http_parser callback on header value in HTTP request.
* May be invoked ATLEAST once every header value
* May be invoked AT LEAST once every header value
*/
static esp_err_t cb_header_value(http_parser *parser, const char *at, size_t length)
{
Expand Down

0 comments on commit 779ac50

Please sign in to comment.