]> git.saurik.com Git - apt.git/blobdiff - methods/http_main.cc
You have to do the bounds check before the access.
[apt.git] / methods / http_main.cc
index 2c46ab19dbfe79fe19d6180b721bca9d0f964762..1e56044b72233dc7789d896847f336d123bfe365 100644 (file)
@@ -1,15 +1,17 @@
+#include <config.h>
 #include <apt-pkg/fileutl.h>
-#include <apt-pkg/acquire-method.h>
+#include <apt-pkg/error.h>
+#include <signal.h>
 
-#include "connect.h"
-#include "rfc2553emu.h"
 #include "http.h"
 
-
-int main()
+int main(int, const char *argv[])
 {
-   setlocale(LC_ALL, "");
-
-   HttpMethod Mth;
-   return Mth.Loop();
+   // ignore SIGPIPE, this can happen on write() if the socket
+   // closes the connection (this is dealt with via ServerDie())
+   signal(SIGPIPE, SIG_IGN);
+   std::string Binary = flNotDir(argv[0]);
+   if (Binary.find('+') == std::string::npos && Binary != "http")
+      Binary.append("+http");
+   return HttpMethod(std::move(Binary)).Loop();
 }