summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2013-05-08 17:50:15 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2013-05-08 17:50:15 +0200
commit5b63d2a9a2e088bb7df7c703e9452af7efc88210 (patch)
tree2963ecbef09696faadd2ee971bb8a1f8e5a82463 /methods/http.cc
parent597341fe0f0a87c3888a62ce02631db8b25aeb4b (diff)
merged patch from Daniel Hartwig to fix URI and proxy releated issues
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/methods/http.cc b/methods/http.cc
index fddf8a78e..db1085a2d 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -667,7 +667,12 @@ void HttpMethod::SendReq(FetchItem *Itm,CircleBuf &Out)
// The HTTP server expects a hostname with a trailing :port
char Buf[1000];
- string ProperHost = Uri.Host;
+ string ProperHost;
+
+ if (Uri.Host.find(':') != string::npos)
+ ProperHost = '[' + Uri.Host + ']';
+ else
+ ProperHost = Uri.Host;
if (Uri.Port != 0)
{
sprintf(Buf,":%u",Uri.Port);
@@ -975,12 +980,7 @@ HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
{
URI Uri = Queue->Uri;
if (Uri.Host.empty() == false)
- {
- if (Uri.Port != 0)
- strprintf(NextURI, "http://%s:%u", Uri.Host.c_str(), Uri.Port);
- else
- NextURI = "http://" + Uri.Host;
- }
+ NextURI = URI::SiteOnly(Uri);
else
NextURI.clear();
NextURI.append(DeQuoteString(Srv->Location));