Skip to content

Commit c1931f0

Browse files
committed
Merge branch 'feature/add_support_for_http_1.0_requests_v5.1' into 'release/v5.1'
feat(esp_http_server): add support to handle HTTP 1.0 requests (v5.1) See merge request espressif/esp-idf!35662
2 parents ddf1949 + 098291a commit c1931f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/esp_http_server/include/esp_http_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ typedef enum {
565565
*/
566566
HTTPD_501_METHOD_NOT_IMPLEMENTED,
567567

568-
/* When HTTP version is not 1.1 */
568+
/* When HTTP version is not 1.1 or 1.0*/
569569
HTTPD_505_VERSION_NOT_SUPPORTED,
570570

571571
/* Returned when http_parser halts parsing due to incorrect

components/esp_http_server/src/httpd_parse.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ static esp_err_t verify_url (http_parser *parser)
8989
strlcpy((char *)r->uri, at, (length + 1));
9090
ESP_LOGD(TAG, LOG_FMT("received URI = %s"), r->uri);
9191

92-
/* Make sure version is HTTP/1.1 */
93-
if (!((parser->http_major == 1) && (parser->http_minor == 1))) {
92+
/* Make sure version is HTTP/1.1 or HTTP/1.0 (legacy compliance purpose) */
93+
if (!((parser->http_major == 1) && ((parser->http_minor == 0) || (parser->http_minor == 1)))) {
9494
ESP_LOGW(TAG, LOG_FMT("unsupported HTTP version = %d.%d"),
9595
parser->http_major, parser->http_minor);
9696
parser_data->error = HTTPD_505_VERSION_NOT_SUPPORTED;

0 commit comments

Comments
 (0)