summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:34:56 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-05-31 10:34:56 +0200
commit3b310a644d82abeb76b5028a9ee7b8d1b96fc629 (patch)
tree4f700ae465eb6c065dfba405741c1ab800e06f11 /methods/http.cc
parentc996a75cabffa5d3e5bc610d9f1097c2edae606f (diff)
parent4fdb612374655361c8923a4611db6a0d10054317 (diff)
merged from the debian branch
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/methods/http.cc b/methods/http.cc
index dfc1619e3..13f9cbe06 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -778,9 +778,10 @@ bool HttpMethod::Go(bool ToFile,ServerState *Srv)
if (Srv->In.WriteSpace() == true && ToFile == true && FileFD != -1)
FD_SET(FileFD,&wfds);
-
+
// Add stdin
- FD_SET(STDIN_FILENO,&rfds);
+ if (_config->FindB("Acquire::http::DependOnSTDIN", true) == true)
+ FD_SET(STDIN_FILENO,&rfds);
// Figure out the max fd
int MaxFd = FileFD;
@@ -947,9 +948,25 @@ HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv)
&& Srv->Result != 304 // Not Modified
&& Srv->Result != 306)) // (Not part of HTTP/1.1, reserved)
{
- if (!Srv->Location.empty())
+ if (Srv->Location.empty() == true);
+ else if (Srv->Location[0] == '/' && Queue->Uri.empty() == false)
{
- NextURI = Srv->Location;
+ 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;
+ }
+ else
+ NextURI.clear();
+ NextURI.append(DeQuoteString(Srv->Location));
+ return TRY_AGAIN_OR_REDIRECT;
+ }
+ else
+ {
+ NextURI = DeQuoteString(Srv->Location);
return TRY_AGAIN_OR_REDIRECT;
}
/* else pass through for error message */
@@ -1113,7 +1130,13 @@ int HttpMethod::Loop()
do a WaitFd above.. Otherwise the FD is closed. */
int Result = Run(true);
if (Result != -1 && (Result != 0 || Queue == 0))
- return 100;
+ {
+ if(FailReason.empty() == false ||
+ _config->FindB("Acquire::http::DependOnSTDIN", true) == true)
+ return 100;
+ else
+ return 0;
+ }
if (Queue == 0)
continue;