Merge branch 'bugfix/http_literal_caseinsensitive' into 'master'

Compare case-insensitive URI schemes

See merge request idf/esp-idf!3558
This commit is contained in:
Jiang Jiang Jian 2018-11-12 17:03:06 +08:00
commit ef4a87d62e
2 changed files with 4 additions and 4 deletions

View File

@ -488,9 +488,9 @@ static int get_port(const char *url, struct http_parser_url *u)
if (u->field_data[UF_PORT].len) { if (u->field_data[UF_PORT].len) {
return strtol(&url[u->field_data[UF_PORT].off], NULL, 10); return strtol(&url[u->field_data[UF_PORT].off], NULL, 10);
} else { } else {
if (strncmp(&url[u->field_data[UF_SCHEMA].off], "http", u->field_data[UF_SCHEMA].len) == 0) { if (strncasecmp(&url[u->field_data[UF_SCHEMA].off], "http", u->field_data[UF_SCHEMA].len) == 0) {
return 80; return 80;
} else if (strncmp(&url[u->field_data[UF_SCHEMA].off], "https", u->field_data[UF_SCHEMA].len) == 0) { } else if (strncasecmp(&url[u->field_data[UF_SCHEMA].off], "https", u->field_data[UF_SCHEMA].len) == 0) {
return 443; return 443;
} }
} }

View File

@ -1175,9 +1175,9 @@ bool esp_http_client_is_chunked_response(esp_http_client_handle_t client)
esp_http_client_transport_t esp_http_client_get_transport_type(esp_http_client_handle_t client) esp_http_client_transport_t esp_http_client_get_transport_type(esp_http_client_handle_t client)
{ {
if (!strcmp(client->connection_info.scheme, "https") ) { if (!strcasecmp(client->connection_info.scheme, "https") ) {
return HTTP_TRANSPORT_OVER_SSL; return HTTP_TRANSPORT_OVER_SSL;
} else if (!strcmp(client->connection_info.scheme, "http")) { } else if (!strcasecmp(client->connection_info.scheme, "http")) {
return HTTP_TRANSPORT_OVER_TCP; return HTTP_TRANSPORT_OVER_TCP;
} else { } else {
return HTTP_TRANSPORT_UNKNOWN; return HTTP_TRANSPORT_UNKNOWN;