// -*- 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.
#include <signal.h>
#include <stdio.h>
#include <errno.h>
+#include <string.h>
+#include <iostream>
// Internet stuff
#include <netdb.h>
#include "http.h"
/*}}}*/
+using namespace std;
string HttpMethod::FailFile;
int HttpMethod::FailFd = -1;
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;
{
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;
}
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] == '/')
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)
{
// Send status to APT
if (Result == true)
{
- Res.MD5Sum = Server->In.Hash->MD5.Result();
+ Res.TakeHashes(*Server->In.Hash);
URIDone(Res);
}
else
// Hard internal error, kill the connection and fail
case 5:
{
+ delete File;
+ File = 0;
+
Fail();
RotateDNS();
Server->Close();
return Mth.Loop();
}
+
+