Sfoglia il codice sorgente

Remove Metalink content-type after first server response.

We don't accept Metalink content-type after first server response.
Tatsuhiro Tsujikawa 14 anni fa
parent
commit
5a4a627d72
3 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 1 0
      src/HttpResponseCommand.cc
  2. 5 0
      src/util.cc
  3. 1 0
      src/util.h

+ 1 - 0
src/HttpResponseCommand.cc

@@ -204,6 +204,7 @@ bool HttpResponseCommand::executeInternal()
     }
   }
   if(!getPieceStorage()) {
+    util::removeMetalinkContentTypes(getRequestGroup());
     uint64_t totalLength = httpResponse->getEntityLength();
     getFileEntry()->setLength(totalLength);
     if(getFileEntry()->getPath().empty()) {

+ 5 - 0
src/util.cc

@@ -1459,6 +1459,11 @@ bool inSameCidrBlock(const std::string& ip1, const std::string& ip2, int bits)
 }
 
 void removeMetalinkContentTypes(const SharedHandle<RequestGroup>& group)
+{
+  removeMetalinkContentTypes(group.get());
+}
+
+void removeMetalinkContentTypes(RequestGroup* group)
 {
   for(std::vector<std::string>::const_iterator i =
 	DownloadHandlerConstants::getMetalinkContentTypes().begin(),

+ 1 - 0
src/util.h

@@ -415,6 +415,7 @@ bool getCidrPrefix(struct in_addr& in, const std::string& ip, int bits);
 bool inSameCidrBlock(const std::string& ip1, const std::string& ip2, int bits);
 
 void removeMetalinkContentTypes(const SharedHandle<RequestGroup>& group);
+void removeMetalinkContentTypes(RequestGroup* group);
 
 // No throw
 void executeHookByOptName