forked from espressif/esp-idf
feat(esp_http_server): add support to handle HTTP 1.0 requests
This commit adds support to handle HTTP/1.0 requests alongside HTTP/1.1 for legacy compliance purposes.
This commit is contained in:
@@ -565,7 +565,7 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
HTTPD_501_METHOD_NOT_IMPLEMENTED,
|
HTTPD_501_METHOD_NOT_IMPLEMENTED,
|
||||||
|
|
||||||
/* When HTTP version is not 1.1 */
|
/* When HTTP version is not 1.1 or 1.0*/
|
||||||
HTTPD_505_VERSION_NOT_SUPPORTED,
|
HTTPD_505_VERSION_NOT_SUPPORTED,
|
||||||
|
|
||||||
/* Returned when http_parser halts parsing due to incorrect
|
/* Returned when http_parser halts parsing due to incorrect
|
||||||
|
@@ -89,8 +89,8 @@ static esp_err_t verify_url (http_parser *parser)
|
|||||||
strlcpy((char *)r->uri, at, (length + 1));
|
strlcpy((char *)r->uri, at, (length + 1));
|
||||||
ESP_LOGD(TAG, LOG_FMT("received URI = %s"), r->uri);
|
ESP_LOGD(TAG, LOG_FMT("received URI = %s"), r->uri);
|
||||||
|
|
||||||
/* Make sure version is HTTP/1.1 */
|
/* Make sure version is HTTP/1.1 or HTTP/1.0 (legacy compliance purpose) */
|
||||||
if (!((parser->http_major == 1) && (parser->http_minor == 1))) {
|
if (!((parser->http_major == 1) && ((parser->http_minor == 0) || (parser->http_minor == 1)))) {
|
||||||
ESP_LOGW(TAG, LOG_FMT("unsupported HTTP version = %d.%d"),
|
ESP_LOGW(TAG, LOG_FMT("unsupported HTTP version = %d.%d"),
|
||||||
parser->http_major, parser->http_minor);
|
parser->http_major, parser->http_minor);
|
||||||
parser_data->error = HTTPD_505_VERSION_NOT_SUPPORTED;
|
parser_data->error = HTTPD_505_VERSION_NOT_SUPPORTED;
|
||||||
|
Reference in New Issue
Block a user