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

pull/1/head
Tatsuhiro Tsujikawa 2011-02-09 23:01:01 +09:00
parent ffce1848ca
commit 1a9d3b7711
1 changed files with 7 additions and 2 deletions

View File

@ -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";
}