http: Compare case-insensitive URI schemes like as in other places

This commit is contained in:
Anton Maklakov 2018-10-25 21:03:44 +08:00
parent 822de0d038
commit 6e6f07ba59
2 changed files with 4 additions and 4 deletions

View File

@ -456,9 +456,9 @@ static int get_port(const char *url, struct http_parser_url *u)
if (u->field_data[UF_PORT].len) {
return strtol(&url[u->field_data[UF_PORT].off], NULL, 10);
} 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;
} 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;
}
}

View File

@ -1171,9 +1171,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)
{
if (!strcmp(client->connection_info.scheme, "https") ) {
if (!strcasecmp(client->connection_info.scheme, "https") ) {
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;
} else {
return HTTP_TRANSPORT_UNKNOWN;