Commit 1ff61837 authored by Dmitry Frank's avatar Dmitry Frank Committed by Cesanta Bot

Fix mg_http_common_url_parse

The only client of `mg_http_common_url_parse` (namely,
`mg_connect_http_base`) expects `port_i` to be the index in the address
string at which the port was added.

PUBLISHED_FROM=b095926b5485e4674e3c59ff8481171831fb61ae
parent 3a8464e4
...@@ -7421,8 +7421,8 @@ MG_INTERNAL int mg_http_common_url_parse(const char *url, const char *schema, ...@@ -7421,8 +7421,8 @@ MG_INTERNAL int mg_http_common_url_parse(const char *url, const char *schema,
if (addr_len == 0) goto cleanup; if (addr_len == 0) goto cleanup;
if (port_pos < 0) { if (port_pos < 0) {
*port_i = *use_ssl ? 443 : 80; *port_i = addr_len;
addr_len += sprintf(*addr + addr_len, ":%d", *port_i); addr_len += sprintf(*addr + addr_len, ":%d", *use_ssl ? 443 : 80);
} else { } else {
*port_i = -1; *port_i = -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment