{
static char ipbuf[MAX_IPSTRLEN];
- // TODO Must() on URI length>0 when the parser supports throw. For now avoid assert().
- if (!hp.requestUri().length() && hp.requestUri()[0] != '/')
+ // TODO Must() on URI !empty when the parser supports throw. For now avoid assert().
+ if (!hp.requestUri().isEmpty() && hp.requestUri()[0] != '/')
return; /* already in good shape */
/* BUG: Squid cannot deal with '*' URLs (RFC2616 5.1.2) */
const int url_sz = hp.requestUri().length() + 32 + Config.appendDomainLen +
strlen(host);
http->uri = (char *)xcalloc(url_sz, 1);
- snprintf(http->uri, url_sz, "%s://%s%s", AnyP::UriScheme(conn->port->transport.protocol).c_str(), host, SBuf(hp.requestUri()).c_str());
- debugs(33, 5, "TRANSPARENT HOST REWRITE: '" << http->uri <<"'");
+ snprintf(http->uri, url_sz, "%s://%s" SQUIDSBUFPH,
+ AnyP::UriScheme(conn->port->transport.protocol).c_str(), host, SQUIDSBUFPRINT(hp.requestUri()));
+ debugs(33, 5, "TRANSPARENT HOST REWRITE: " << http->uri);
} else {
/* Put the local socket IP address as the hostname. */
const int url_sz = hp.requestUri().length() + 32 + Config.appendDomainLen;
http->uri = (char *)xcalloc(url_sz, 1);
http->getConn()->clientConnection->local.toHostStr(ipbuf,MAX_IPSTRLEN);
- snprintf(http->uri, url_sz, "%s://%s:%d%s",
+ snprintf(http->uri, url_sz, "%s://%s:%d" SQUIDSBUFPH,
AnyP::UriScheme(http->getConn()->port->transport.protocol).c_str(),
- ipbuf, http->getConn()->clientConnection->local.port(), SBuf(hp.requestUri()).c_str());
- debugs(33, 5, "TRANSPARENT REWRITE: '" << http->uri << "'");
+ ipbuf, http->getConn()->clientConnection->local.port(), SQUIDSBUFPRINT(hp.requestUri()));
+ debugs(33, 5, "TRANSPARENT REWRITE: " << http->uri);
}
}