]>
git.saurik.com Git - apt.git/blob - methods/http.cc
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: http.cc,v 1.47 2001/02/20 07:03:18 jgg Exp $
4 /* ######################################################################
6 HTTP Aquire Method - This is the HTTP aquire method for APT.
8 It uses HTTP/1.1 and many of the fancy options there-in, such as
9 pipelining, range, if-range and so on.
11 It is based on a doubly buffered select loop. A groupe of requests are
12 fed into a single output buffer that is constantly fed out the
13 socket. This provides ideal pipelining as in many cases all of the
14 requests will fit into a single packet. The input socket is buffered
15 the same way and fed into the fd for the file (may be a pipe in future).
17 This double buffering provides fairly substantial transfer rates,
18 compared to wget the http method is about 4% faster. Most importantly,
19 when HTTP is compared with FTP as a protocol the speed difference is
20 huge. In tests over the internet from two sites to llug (via ATM) this
21 program got 230k/s sustained http transfer rates. FTP on the other
22 hand topped out at 170k/s. That combined with the time to setup the
23 FTP connection makes HTTP a vastly superior protocol.
25 ##################################################################### */
27 // Include Files /*{{{*/
28 #include <apt-pkg/fileutl.h>
29 #include <apt-pkg/acquire-method.h>
30 #include <apt-pkg/error.h>
31 #include <apt-pkg/md5.h>
45 #include "rfc2553emu.h"
50 string
HttpMethod::FailFile
;
51 int HttpMethod::FailFd
= -1;
52 time_t HttpMethod::FailTime
= 0;
53 unsigned long PipelineDepth
= 10;
54 unsigned long TimeOut
= 120;
57 // CircleBuf::CircleBuf - Circular input buffer /*{{{*/
58 // ---------------------------------------------------------------------
60 CircleBuf::CircleBuf(unsigned long Size
) : Size(Size
), MD5(0)
62 Buf
= new unsigned char[Size
];
66 // CircleBuf::Reset - Reset to the default state /*{{{*/
67 // ---------------------------------------------------------------------
69 void CircleBuf::Reset()
74 MaxGet
= (unsigned int)-1;
79 MD5
= new MD5Summation
;
83 // CircleBuf::Read - Read from a FD into the circular buffer /*{{{*/
84 // ---------------------------------------------------------------------
85 /* This fills up the buffer with as much data as is in the FD, assuming it
87 bool CircleBuf::Read(int Fd
)
91 // Woops, buffer is full
92 if (InP
- OutP
== Size
)
95 // Write the buffer segment
97 Res
= read(Fd
,Buf
+ (InP%Size
),LeftRead());
109 gettimeofday(&Start
,0);
114 // CircleBuf::Read - Put the string into the buffer /*{{{*/
115 // ---------------------------------------------------------------------
116 /* This will hold the string in and fill the buffer with it as it empties */
117 bool CircleBuf::Read(string Data
)
124 // CircleBuf::FillOut - Fill the buffer from the output queue /*{{{*/
125 // ---------------------------------------------------------------------
127 void CircleBuf::FillOut()
129 if (OutQueue
.empty() == true)
133 // Woops, buffer is full
134 if (InP
- OutP
== Size
)
137 // Write the buffer segment
138 unsigned long Sz
= LeftRead();
139 if (OutQueue
.length() - StrPos
< Sz
)
140 Sz
= OutQueue
.length() - StrPos
;
141 memcpy(Buf
+ (InP%Size
),OutQueue
.begin() + StrPos
,Sz
);
146 if (OutQueue
.length() == StrPos
)
155 // CircleBuf::Write - Write from the buffer into a FD /*{{{*/
156 // ---------------------------------------------------------------------
157 /* This empties the buffer into the FD. */
158 bool CircleBuf::Write(int Fd
)
164 // Woops, buffer is empty
171 // Write the buffer segment
173 Res
= write(Fd
,Buf
+ (OutP%Size
),LeftWrite());
186 MD5
->Add(Buf
+ (OutP%Size
),Res
);
192 // CircleBuf::WriteTillEl - Write from the buffer to a string /*{{{*/
193 // ---------------------------------------------------------------------
194 /* This copies till the first empty line */
195 bool CircleBuf::WriteTillEl(string
&Data
,bool Single
)
197 // We cheat and assume it is unneeded to have more than one buffer load
198 for (unsigned long I
= OutP
; I
< InP
; I
++)
200 if (Buf
[I%Size
] != '\n')
202 for (I
++; I
< InP
&& Buf
[I%Size
] == '\r'; I
++);
206 if (Buf
[I%Size
] != '\n')
208 for (I
++; I
< InP
&& Buf
[I%Size
] == '\r'; I
++);
217 unsigned long Sz
= LeftWrite();
220 if (I
- OutP
< LeftWrite())
222 Data
+= string((char *)(Buf
+ (OutP%Size
)),Sz
);
230 // CircleBuf::Stats - Print out stats information /*{{{*/
231 // ---------------------------------------------------------------------
233 void CircleBuf::Stats()
239 gettimeofday(&Stop
,0);
240 /* float Diff = Stop.tv_sec - Start.tv_sec +
241 (float)(Stop.tv_usec - Start.tv_usec)/1000000;
242 clog << "Got " << InP << " in " << Diff << " at " << InP/Diff << endl;*/
246 // ServerState::ServerState - Constructor /*{{{*/
247 // ---------------------------------------------------------------------
249 ServerState::ServerState(URI Srv
,HttpMethod
*Owner
) : Owner(Owner
),
250 In(64*1024), Out(4*1024),
256 // ServerState::Open - Open a connection to the server /*{{{*/
257 // ---------------------------------------------------------------------
258 /* This opens a connection to the server. */
259 bool ServerState::Open()
261 // Use the already open connection if possible.
270 // Determine the proxy setting
271 if (getenv("http_proxy") == 0)
273 string DefProxy
= _config
->Find("Acquire::http::Proxy");
274 string SpecificProxy
= _config
->Find("Acquire::http::Proxy::" + ServerName
.Host
);
275 if (SpecificProxy
.empty() == false)
277 if (SpecificProxy
== "DIRECT")
280 Proxy
= SpecificProxy
;
286 Proxy
= getenv("http_proxy");
288 // Parse no_proxy, a , separated list of hosts
289 if (getenv("no_proxy") != 0)
291 const char *Start
= getenv("no_proxy");
292 for (const char *Cur
= Start
; true ; Cur
++)
294 if (*Cur
!= ',' && *Cur
!= 0)
296 if (stringcasecmp(ServerName
.Host
.begin(),ServerName
.Host
.end(),
309 // Determine what host and port to use based on the proxy settings
312 if (Proxy
.empty() == true || Proxy
.Host
.empty() == true)
314 if (ServerName
.Port
!= 0)
315 Port
= ServerName
.Port
;
316 Host
= ServerName
.Host
;
325 // Connect to the remote server
326 if (Connect(Host
,Port
,"http",80,ServerFd
,TimeOut
,Owner
) == false)
332 // ServerState::Close - Close a connection to the server /*{{{*/
333 // ---------------------------------------------------------------------
335 bool ServerState::Close()
342 // ServerState::RunHeaders - Get the headers before the data /*{{{*/
343 // ---------------------------------------------------------------------
344 /* Returns 0 if things are OK, 1 if an IO error occursed and 2 if a header
345 parse error occured */
346 int ServerState::RunHeaders()
350 Owner
->Status("Waiting for file");
364 if (In
.WriteTillEl(Data
) == false)
370 for (string::const_iterator I
= Data
.begin(); I
< Data
.end(); I
++)
372 string::const_iterator J
= I
;
373 for (; J
!= Data
.end() && *J
!= '\n' && *J
!= '\r';J
++);
374 if (HeaderLine(string(I
,J
-I
)) == false)
379 // 100 Continue is a Nop...
383 // Tidy up the connection persistance state.
384 if (Encoding
== Closes
&& HaveContent
== true)
389 while (Owner
->Go(false,this) == true);
394 // ServerState::RunData - Transfer the data from the socket /*{{{*/
395 // ---------------------------------------------------------------------
397 bool ServerState::RunData()
401 // Chunked transfer encoding is fun..
402 if (Encoding
== Chunked
)
406 // Grab the block size
412 if (In
.WriteTillEl(Data
,true) == true)
415 while ((Last
= Owner
->Go(false,this)) == true);
420 // See if we are done
421 unsigned long Len
= strtol(Data
.c_str(),0,16);
426 // We have to remove the entity trailer
430 if (In
.WriteTillEl(Data
,true) == true && Data
.length() <= 2)
433 while ((Last
= Owner
->Go(false,this)) == true);
436 return !_error
->PendingError();
439 // Transfer the block
441 while (Owner
->Go(true,this) == true)
442 if (In
.IsLimit() == true)
446 if (In
.IsLimit() == false)
449 // The server sends an extra new line before the next block specifier..
454 if (In
.WriteTillEl(Data
,true) == true)
457 while ((Last
= Owner
->Go(false,this)) == true);
464 /* Closes encoding is used when the server did not specify a size, the
465 loss of the connection means we are done */
466 if (Encoding
== Closes
)
469 In
.Limit(Size
- StartPos
);
471 // Just transfer the whole block.
474 if (In
.IsLimit() == false)
478 return !_error
->PendingError();
480 while (Owner
->Go(true,this) == true);
483 return Owner
->Flush(this) && !_error
->PendingError();
486 // ServerState::HeaderLine - Process a header line /*{{{*/
487 // ---------------------------------------------------------------------
489 bool ServerState::HeaderLine(string Line
)
491 if (Line
.empty() == true)
494 // The http server might be trying to do something evil.
495 if (Line
.length() >= MAXLEN
)
496 return _error
->Error("Got a single header line over %u chars",MAXLEN
);
498 string::size_type Pos
= Line
.find(' ');
499 if (Pos
== string::npos
|| Pos
+1 > Line
.length())
501 // Blah, some servers use "connection:closes", evil.
502 Pos
= Line
.find(':');
503 if (Pos
== string::npos
|| Pos
+ 2 > Line
.length())
504 return _error
->Error("Bad header line");
508 // Parse off any trailing spaces between the : and the next word.
509 string::size_type Pos2
= Pos
;
510 while (Pos2
< Line
.length() && isspace(Line
[Pos2
]) != 0)
513 string Tag
= string(Line
,0,Pos
);
514 string Val
= string(Line
,Pos2
);
516 if (stringcasecmp(Tag
.begin(),Tag
.begin()+4,"HTTP") == 0)
518 // Evil servers return no version
521 if (sscanf(Line
.c_str(),"HTTP/%u.%u %u %[^\n]",&Major
,&Minor
,
523 return _error
->Error("The http server sent an invalid reply header");
529 if (sscanf(Line
.c_str(),"HTTP %u %[^\n]",&Result
,Code
) != 2)
530 return _error
->Error("The http server sent an invalid reply header");
533 /* Check the HTTP response header to get the default persistance
539 if (Major
== 1 && Minor
<= 0)
548 if (stringcasecmp(Tag
,"Content-Length:") == 0)
550 if (Encoding
== Closes
)
554 // The length is already set from the Content-Range header
558 if (sscanf(Val
.c_str(),"%lu",&Size
) != 1)
559 return _error
->Error("The http server sent an invalid Content-Length header");
563 if (stringcasecmp(Tag
,"Content-Type:") == 0)
569 if (stringcasecmp(Tag
,"Content-Range:") == 0)
573 if (sscanf(Val
.c_str(),"bytes %lu-%*u/%lu",&StartPos
,&Size
) != 2)
574 return _error
->Error("The http server sent an invalid Content-Range header");
575 if ((unsigned)StartPos
> Size
)
576 return _error
->Error("This http server has broken range support");
580 if (stringcasecmp(Tag
,"Transfer-Encoding:") == 0)
583 if (stringcasecmp(Val
,"chunked") == 0)
588 if (stringcasecmp(Tag
,"Connection:") == 0)
590 if (stringcasecmp(Val
,"close") == 0)
592 if (stringcasecmp(Val
,"keep-alive") == 0)
597 if (stringcasecmp(Tag
,"Last-Modified:") == 0)
599 if (StrToTime(Val
,Date
) == false)
600 return _error
->Error("Unknown date format");
608 // HttpMethod::SendReq - Send the HTTP request /*{{{*/
609 // ---------------------------------------------------------------------
610 /* This places the http request in the outbound buffer */
611 void HttpMethod::SendReq(FetchItem
*Itm
,CircleBuf
&Out
)
615 // The HTTP server expects a hostname with a trailing :port
617 string ProperHost
= Uri
.Host
;
620 sprintf(Buf
,":%u",Uri
.Port
);
625 if (Itm
->Uri
.length() >= sizeof(Buf
))
628 /* Build the request. We include a keep-alive header only for non-proxy
629 requests. This is to tweak old http/1.0 servers that do support keep-alive
630 but not HTTP/1.1 automatic keep-alive. Doing this with a proxy server
631 will glitch HTTP/1.0 proxies because they do not filter it out and
632 pass it on, HTTP/1.1 says the connection should default to keep alive
633 and we expect the proxy to do this */
634 if (Proxy
.empty() == true)
635 sprintf(Buf
,"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: keep-alive\r\n",
636 QuoteString(Uri
.Path
,"~").c_str(),ProperHost
.c_str());
639 /* Generate a cache control header if necessary. We place a max
640 cache age on index files, optionally set a no-cache directive
641 and a no-store directive for archives. */
642 sprintf(Buf
,"GET %s HTTP/1.1\r\nHost: %s\r\n",
643 Itm
->Uri
.c_str(),ProperHost
.c_str());
644 if (_config
->FindB("Acquire::http::No-Cache",false) == true)
645 strcat(Buf
,"Cache-Control: no-cache\r\nPragma: no-cache\r\n");
648 if (Itm
->IndexFile
== true)
649 sprintf(Buf
+strlen(Buf
),"Cache-Control: max-age=%u\r\n",
650 _config
->FindI("Acquire::http::Max-Age",60*60*24));
653 if (_config
->FindB("Acquire::http::No-Store",false) == true)
654 strcat(Buf
,"Cache-Control: no-store\r\n");
661 // Check for a partial file
663 if (stat(Itm
->DestFile
.c_str(),&SBuf
) >= 0 && SBuf
.st_size
> 0)
665 // In this case we send an if-range query with a range header
666 sprintf(Buf
,"Range: bytes=%li-\r\nIf-Range: %s\r\n",(long)SBuf
.st_size
- 1,
667 TimeRFC1123(SBuf
.st_mtime
).c_str());
672 if (Itm
->LastModified
!= 0)
674 sprintf(Buf
,"If-Modified-Since: %s\r\n",TimeRFC1123(Itm
->LastModified
).c_str());
679 if (Proxy
.User
.empty() == false || Proxy
.Password
.empty() == false)
680 Req
+= string("Proxy-Authorization: Basic ") +
681 Base64Encode(Proxy
.User
+ ":" + Proxy
.Password
) + "\r\n";
683 if (Uri
.User
.empty() == false || Uri
.Password
.empty() == false)
684 Req
+= string("Authorization: Basic ") +
685 Base64Encode(Uri
.User
+ ":" + Uri
.Password
) + "\r\n";
687 Req
+= "User-Agent: Debian APT-HTTP/1.2\r\n\r\n";
695 // HttpMethod::Go - Run a single loop /*{{{*/
696 // ---------------------------------------------------------------------
697 /* This runs the select loop over the server FDs, Output file FDs and
699 bool HttpMethod::Go(bool ToFile
,ServerState
*Srv
)
701 // Server has closed the connection
702 if (Srv
->ServerFd
== -1 && (Srv
->In
.WriteSpace() == false ||
710 /* Add the server. We only send more requests if the connection will
712 if (Srv
->Out
.WriteSpace() == true && Srv
->ServerFd
!= -1
713 && Srv
->Persistent
== true)
714 FD_SET(Srv
->ServerFd
,&wfds
);
715 if (Srv
->In
.ReadSpace() == true && Srv
->ServerFd
!= -1)
716 FD_SET(Srv
->ServerFd
,&rfds
);
723 if (Srv
->In
.WriteSpace() == true && ToFile
== true && FileFD
!= -1)
724 FD_SET(FileFD
,&wfds
);
727 FD_SET(STDIN_FILENO
,&rfds
);
729 // Figure out the max fd
731 if (MaxFd
< Srv
->ServerFd
)
732 MaxFd
= Srv
->ServerFd
;
739 if ((Res
= select(MaxFd
+1,&rfds
,&wfds
,0,&tv
)) < 0)
740 return _error
->Errno("select","Select failed");
744 _error
->Error("Connection timed out");
745 return ServerDie(Srv
);
749 if (Srv
->ServerFd
!= -1 && FD_ISSET(Srv
->ServerFd
,&rfds
))
752 if (Srv
->In
.Read(Srv
->ServerFd
) == false)
753 return ServerDie(Srv
);
756 if (Srv
->ServerFd
!= -1 && FD_ISSET(Srv
->ServerFd
,&wfds
))
759 if (Srv
->Out
.Write(Srv
->ServerFd
) == false)
760 return ServerDie(Srv
);
763 // Send data to the file
764 if (FileFD
!= -1 && FD_ISSET(FileFD
,&wfds
))
766 if (Srv
->In
.Write(FileFD
) == false)
767 return _error
->Errno("write","Error writing to output file");
770 // Handle commands from APT
771 if (FD_ISSET(STDIN_FILENO
,&rfds
))
780 // HttpMethod::Flush - Dump the buffer into the file /*{{{*/
781 // ---------------------------------------------------------------------
782 /* This takes the current input buffer from the Server FD and writes it
784 bool HttpMethod::Flush(ServerState
*Srv
)
788 SetNonBlock(File
->Fd(),false);
789 if (Srv
->In
.WriteSpace() == false)
792 while (Srv
->In
.WriteSpace() == true)
794 if (Srv
->In
.Write(File
->Fd()) == false)
795 return _error
->Errno("write","Error writing to file");
796 if (Srv
->In
.IsLimit() == true)
800 if (Srv
->In
.IsLimit() == true || Srv
->Encoding
== ServerState::Closes
)
806 // HttpMethod::ServerDie - The server has closed the connection. /*{{{*/
807 // ---------------------------------------------------------------------
809 bool HttpMethod::ServerDie(ServerState
*Srv
)
811 unsigned int LErrno
= errno
;
813 // Dump the buffer to the file
814 if (Srv
->State
== ServerState::Data
)
816 SetNonBlock(File
->Fd(),false);
817 while (Srv
->In
.WriteSpace() == true)
819 if (Srv
->In
.Write(File
->Fd()) == false)
820 return _error
->Errno("write","Error writing to the file");
823 if (Srv
->In
.IsLimit() == true)
828 // See if this is because the server finished the data stream
829 if (Srv
->In
.IsLimit() == false && Srv
->State
!= ServerState::Header
&&
830 Srv
->Encoding
!= ServerState::Closes
)
834 return _error
->Error("Error reading from server Remote end closed connection");
836 return _error
->Errno("read","Error reading from server");
842 // Nothing left in the buffer
843 if (Srv
->In
.WriteSpace() == false)
846 // We may have got multiple responses back in one packet..
854 // HttpMethod::DealWithHeaders - Handle the retrieved header data /*{{{*/
855 // ---------------------------------------------------------------------
856 /* We look at the header data we got back from the server and decide what
860 3 - Unrecoverable error
861 4 - Error with error content page
862 5 - Unrecoverable non-server error (close the connection) */
863 int HttpMethod::DealWithHeaders(FetchResult
&Res
,ServerState
*Srv
)
866 if (Srv
->Result
== 304)
868 unlink(Queue
->DestFile
.c_str());
870 Res
.LastModified
= Queue
->LastModified
;
874 /* We have a reply we dont handle. This should indicate a perm server
876 if (Srv
->Result
< 200 || Srv
->Result
>= 300)
878 _error
->Error("%u %s",Srv
->Result
,Srv
->Code
);
879 if (Srv
->HaveContent
== true)
884 // This is some sort of 2xx 'data follows' reply
885 Res
.LastModified
= Srv
->Date
;
886 Res
.Size
= Srv
->Size
;
890 File
= new FileFd(Queue
->DestFile
,FileFd::WriteAny
);
891 if (_error
->PendingError() == true)
894 FailFile
= Queue
->DestFile
;
895 FailFile
.c_str(); // Make sure we dont do a malloc in the signal handler
897 FailTime
= Srv
->Date
;
899 // Set the expected size
900 if (Srv
->StartPos
>= 0)
902 Res
.ResumePoint
= Srv
->StartPos
;
903 ftruncate(File
->Fd(),Srv
->StartPos
);
906 // Set the start point
907 lseek(File
->Fd(),0,SEEK_END
);
910 Srv
->In
.MD5
= new MD5Summation
;
912 // Fill the MD5 Hash if the file is non-empty (resume)
913 if (Srv
->StartPos
> 0)
915 lseek(File
->Fd(),0,SEEK_SET
);
916 if (Srv
->In
.MD5
->AddFD(File
->Fd(),Srv
->StartPos
) == false)
918 _error
->Errno("read","Problem hashing file");
921 lseek(File
->Fd(),0,SEEK_END
);
924 SetNonBlock(File
->Fd(),true);
928 // HttpMethod::SigTerm - Handle a fatal signal /*{{{*/
929 // ---------------------------------------------------------------------
930 /* This closes and timestamps the open file. This is neccessary to get
931 resume behavoir on user abort */
932 void HttpMethod::SigTerm(int)
940 UBuf
.actime
= FailTime
;
941 UBuf
.modtime
= FailTime
;
942 utime(FailFile
.c_str(),&UBuf
);
947 // HttpMethod::Fetch - Fetch an item /*{{{*/
948 // ---------------------------------------------------------------------
949 /* This adds an item to the pipeline. We keep the pipeline at a fixed
951 bool HttpMethod::Fetch(FetchItem
*)
956 // Queue the requests
959 for (FetchItem
*I
= Queue
; I
!= 0 && Depth
< (signed)PipelineDepth
;
960 I
= I
->Next
, Depth
++)
962 // If pipelining is disabled, we only queue 1 request
963 if (Server
->Pipeline
== false && Depth
>= 0)
966 // Make sure we stick with the same server
967 if (Server
->Comp(I
->Uri
) == false)
974 SendReq(I
,Server
->Out
);
982 // HttpMethod::Configuration - Handle a configuration message /*{{{*/
983 // ---------------------------------------------------------------------
984 /* We stash the desired pipeline depth */
985 bool HttpMethod::Configuration(string Message
)
987 if (pkgAcqMethod::Configuration(Message
) == false)
990 TimeOut
= _config
->FindI("Acquire::http::Timeout",TimeOut
);
991 PipelineDepth
= _config
->FindI("Acquire::http::Pipeline-Depth",
993 Debug
= _config
->FindB("Debug::Acquire::http",false);
998 // HttpMethod::Loop - Main loop /*{{{*/
999 // ---------------------------------------------------------------------
1001 int HttpMethod::Loop()
1003 signal(SIGTERM
,SigTerm
);
1004 signal(SIGINT
,SigTerm
);
1008 int FailCounter
= 0;
1011 // We have no commands, wait for some to arrive
1014 if (WaitFd(STDIN_FILENO
) == false)
1018 /* Run messages, we can accept 0 (no message) if we didn't
1019 do a WaitFd above.. Otherwise the FD is closed. */
1020 int Result
= Run(true);
1021 if (Result
!= -1 && (Result
!= 0 || Queue
== 0))
1027 // Connect to the server
1028 if (Server
== 0 || Server
->Comp(Queue
->Uri
) == false)
1031 Server
= new ServerState(Queue
->Uri
,this);
1034 /* If the server has explicitly said this is the last connection
1035 then we pre-emptively shut down the pipeline and tear down
1036 the connection. This will speed up HTTP/1.0 servers a tad
1037 since we don't have to wait for the close sequence to
1039 if (Server
->Persistent
== false)
1042 // Reset the pipeline
1043 if (Server
->ServerFd
== -1)
1046 // Connnect to the host
1047 if (Server
->Open() == false)
1055 // Fill the pipeline.
1058 // Fetch the next URL header data from the server.
1059 switch (Server
->RunHeaders())
1064 // The header data is bad
1067 _error
->Error("Bad header Data");
1073 // The server closed a connection during the header get..
1080 Server
->Pipeline
= false;
1082 if (FailCounter
>= 2)
1084 Fail("Connection failed",true);
1093 // Decide what to do.
1095 Res
.Filename
= Queue
->DestFile
;
1096 switch (DealWithHeaders(Res
,Server
))
1098 // Ok, the file is Open
1104 bool Result
= Server
->RunData();
1106 /* If the server is sending back sizeless responses then fill in
1109 Res
.Size
= File
->Size();
1111 // Close the file, destroy the FD object and timestamp it
1117 struct utimbuf UBuf
;
1119 UBuf
.actime
= Server
->Date
;
1120 UBuf
.modtime
= Server
->Date
;
1121 utime(Queue
->DestFile
.c_str(),&UBuf
);
1123 // Send status to APT
1126 Res
.MD5Sum
= Server
->In
.MD5
->Result();
1142 // Hard server error, not found or something
1149 // Hard internal error, kill the connection and fail
1158 // We need to flush the data, the header is like a 404 w/ error text
1163 // Send to content to dev/null
1164 File
= new FileFd("/dev/null",FileFd::WriteExists
);
1172 Fail("Internal error");