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
This commit is contained in:
Dmitry Frank 2016-11-23 19:48:50 +02:00 committed by Cesanta Bot
parent 3a8464e4b8
commit 1ff61837ac

View File

@ -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 (port_pos < 0) {
*port_i = *use_ssl ? 443 : 80;
addr_len += sprintf(*addr + addr_len, ":%d", *port_i);
*port_i = addr_len;
addr_len += sprintf(*addr + addr_len, ":%d", *use_ssl ? 443 : 80);
} else {
*port_i = -1;
}