mirror of https://github.com/aria2/aria2
Added Date, Expires and Cache-Control response header field to XML-RPC response headers.
parent
ffce1848ca
commit
1a9d3b7711
|
@ -48,6 +48,7 @@
|
||||||
#include "a2functional.h"
|
#include "a2functional.h"
|
||||||
#include "fmt.h"
|
#include "fmt.h"
|
||||||
#include "SocketRecvBuffer.h"
|
#include "SocketRecvBuffer.h"
|
||||||
|
#include "TimeA2.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -151,10 +152,14 @@ void HttpServer::feedResponse(const std::string& status,
|
||||||
const std::string& text,
|
const std::string& text,
|
||||||
const std::string& contentType)
|
const std::string& contentType)
|
||||||
{
|
{
|
||||||
|
std::string httpDate = Time().toHTTPDate();
|
||||||
std::string header = "HTTP/1.1 ";
|
std::string header = "HTTP/1.1 ";
|
||||||
strappend(header, status, "\r\n",
|
strappend(header, status, "\r\n",
|
||||||
"Content-Type: ", contentType, "\r\n",
|
"Date: ", httpDate, "\r\n",
|
||||||
"Content-Length: ", util::uitos(text.size()), "\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()) {
|
if(supportsGZip()) {
|
||||||
header += "Content-Encoding: gzip\r\n";
|
header += "Content-Encoding: gzip\r\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue