Pārlūkot izejas kodu

Added Date, Expires and Cache-Control response header field to XML-RPC response headers.

Tatsuhiro Tsujikawa 14 gadi atpakaļ
vecāks
revīzija
1a9d3b7711
1 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. 7 2
      src/HttpServer.cc

+ 7 - 2
src/HttpServer.cc

@@ -48,6 +48,7 @@
 #include "a2functional.h"
 #include "fmt.h"
 #include "SocketRecvBuffer.h"
+#include "TimeA2.h"
 
 namespace aria2 {
 
@@ -151,10 +152,14 @@ void HttpServer::feedResponse(const std::string& status,
                               const std::string& text,
                               const std::string& contentType)
 {
+  std::string httpDate = Time().toHTTPDate();
   std::string header = "HTTP/1.1 ";
   strappend(header, status, "\r\n",
-            "Content-Type: ", contentType, "\r\n",
-            "Content-Length: ", util::uitos(text.size()), "\r\n");
+            "Date: ", httpDate, "\r\n",
+            "Content-Type: ", contentType, "\r\n");
+  strappend(header, "Content-Length: ", util::uitos(text.size()), "\r\n",
+            "Expires: ", httpDate, "\r\n",
+            "Cache-Control: no-cache\r\n");
   if(supportsGZip()) {
     header += "Content-Encoding: gzip\r\n";
   }