Skip to content

Commit

Permalink
Merge pull request #5228: RGW does not send Date HTTP header when civ…
Browse files Browse the repository at this point in the history
…etweb frontend is used

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
ldachary committed Jul 19, 2015
2 parents 0b0d984 + e39dce7 commit 0c04565
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rgw/rgw_civetweb.cc
Expand Up @@ -152,6 +152,20 @@ int RGWMongoose::send_100_continue()
return mg_write(conn, buf, sizeof(buf) - 1);
}

static void dump_date_header(bufferlist &out)
{
char timestr[TIME_BUF_SIZE];
const time_t gtime = time(NULL);
struct tm result;
struct tm const * const tmp = gmtime_r(&gtime, &result);

if (tmp == NULL)
return;

if (strftime(timestr, sizeof(timestr), "Date: %a, %d %b %Y %H:%M:%S %Z\r\n", tmp))
out.append(timestr);
}

int RGWMongoose::complete_header()
{
header_done = true;
Expand All @@ -160,6 +174,8 @@ int RGWMongoose::complete_header()
return 0;
}

dump_date_header(header_data);

if (explicit_keepalive)
header_data.append("Connection: Keep-Alive\r\n");

Expand Down
1 change: 1 addition & 0 deletions src/rgw/rgw_civetweb.h
Expand Up @@ -3,6 +3,7 @@

#ifndef CEPH_RGW_MONGOOSE_H
#define CEPH_RGW_MONGOOSE_H
#define TIME_BUF_SIZE 128

#include "rgw_client_io.h"

Expand Down

0 comments on commit 0c04565

Please sign in to comment.