summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-28 16:26:27 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2007-03-28 16:26:27 +0000
commit4016aa39481186b2cb8fa348ab5bc21da8d71ef4 (patch)
tree0dbaa6dc678eeb4a2716be34a91323ccef09a066 /src
parentfe9c638735ff74dc5edffeac0f4f4af704331880 (diff)
In http request, suppress port number in http request header if
port is 80 or 443: * src/HttpRequest.cc (getHostText): Suppress port number in http request header if port is 80 or 443. (createProxyRequest): Allways send port number.
Diffstat (limited to 'src')
-rw-r--r--src/HttpRequest.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc
index 888a7f98..9c729bb7 100644
--- a/src/HttpRequest.cc
+++ b/src/HttpRequest.cc
@@ -65,7 +65,7 @@ bool HttpRequest::isRangeSatisfied(const RangeHandle& range) const
string HttpRequest::getHostText(const string& host, in_port_t port) const
{
- return host+":"+Util::itos(port);
+ return host+(port == 80 || port == 443 ? "" : ":"+Util::llitos(port));
}
string HttpRequest::createRequest() const
@@ -131,11 +131,11 @@ string HttpRequest::createRequest() const
string HttpRequest::createProxyRequest() const
{
string requestLine =
- string("CONNECT ")+getHost()+":"+Util::llitos(getPort())+
+ string("CONNECT ")+getHost()+":"+Util::itos(getPort())+
string(" HTTP/1.1\r\n")+
"User-Agent: "+Util::urlencode(userAgent)+"\r\n"+
"Proxy-Connection: close\r\n"+
- "Host: "+getHostText(getHost(), getPort())+"\r\n";
+ "Host: "+getHost()+":"+Util::itos(getPort())+"\r\n";
if(proxyAuthEnabled) {
requestLine += getProxyAuthString();
}