* methods/http.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 27 Apr 2011 08:32:53 +0000 (10:32 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 27 Apr 2011 08:32:53 +0000 (10:32 +0200)
  - add config option to ignore a closed stdin to be able to easily
    use the method as a simple standalone downloader

debian/changelog
methods/http.cc

index 22af470..143661b 100644 (file)
@@ -45,8 +45,11 @@ apt (0.8.14.2) UNRELEASED; urgency=low
   * apt-pkg/acquire-item.cc:
     - apply fix for poorly worded 'locate file' error message from
       Ben Finney, thanks! (Closes: #623171)
+  * methods/http.cc:
+    - add config option to ignore a closed stdin to be able to easily
+      use the method as a simple standalone downloader
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Tue, 26 Apr 2011 22:41:33 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 27 Apr 2011 10:30:47 +0200
 
 apt (0.8.14.1) unstable; urgency=low
 
index dfc1619..26abc14 100644 (file)
@@ -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;
@@ -1113,7 +1114,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;