X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/63b1700fd93787682eedc95546a0364f449f036d..aff4e2f1d87ace62b4fca6078710c90b06cccb60:/methods/http.cc diff --git a/methods/http.cc b/methods/http.cc index 0c520b33c..4521197ed 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: http.cc,v 1.50 2001/03/06 07:15:29 jgg Exp $ +// $Id: http.cc,v 1.54 2002/04/18 05:09:38 jgg Exp $ /* ###################################################################### HTTP Aquire Method - This is the HTTP aquire method for APT. @@ -37,6 +37,8 @@ #include #include #include +#include +#include // Internet stuff #include @@ -46,6 +48,7 @@ #include "http.h" /*}}}*/ +using namespace std; string HttpMethod::FailFile; int HttpMethod::FailFd = -1; @@ -138,7 +141,7 @@ void CircleBuf::FillOut() unsigned long Sz = LeftRead(); if (OutQueue.length() - StrPos < Sz) Sz = OutQueue.length() - StrPos; - memcpy(Buf + (InP%Size),OutQueue.begin() + StrPos,Sz); + memcpy(Buf + (InP%Size),OutQueue.c_str() + StrPos,Sz); // Advance StrPos += Sz; @@ -357,7 +360,7 @@ int ServerState::RunHeaders() { string::const_iterator J = I; for (; J != Data.end() && *J != '\n' && *J != '\r';J++); - if (HeaderLine(string(I,J-I)) == false) + if (HeaderLine(string(I,J)) == false) return 2; I = J; } @@ -499,7 +502,7 @@ bool ServerState::HeaderLine(string Line) string Tag = string(Line,0,Pos); string Val = string(Line,Pos2); - if (stringcasecmp(Tag.begin(),Tag.begin()+4,"HTTP") == 0) + if (stringcasecmp(Tag.c_str(),Tag.c_str()+4,"HTTP") == 0) { // Evil servers return no version if (Line[4] == '/') @@ -723,7 +726,11 @@ bool HttpMethod::Go(bool ToFile,ServerState *Srv) tv.tv_usec = 0; int Res = 0; if ((Res = select(MaxFd+1,&rfds,&wfds,0,&tv)) < 0) + { + if (errno == EINTR) + return true; return _error->Errno("select","Select failed"); + } if (Res == 0) { @@ -1109,7 +1116,7 @@ int HttpMethod::Loop() // Send status to APT if (Result == true) { - Res.MD5Sum = Server->In.Hash->MD5.Result(); + Res.TakeHashes(*Server->In.Hash); URIDone(Res); } else @@ -1135,6 +1142,9 @@ int HttpMethod::Loop() // Hard internal error, kill the connection and fail case 5: { + delete File; + File = 0; + Fail(); RotateDNS(); Server->Close(); @@ -1172,3 +1182,5 @@ int main() return Mth.Loop(); } + +