diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-10 14:19:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-10 14:19:45 +0000 |
commit | 72838791616e71043e13d285852c6351b55c3026 (patch) | |
tree | 5d9ce86467de89e8e63bd3977feb8ebaacf7a188 | |
parent | 77b8f3e342fae4cce70846c2334c4f95c32f54fe (diff) | |
download | rspamd-72838791616e71043e13d285852c6351b55c3026.tar.gz rspamd-72838791616e71043e13d285852c6351b55c3026.zip |
[Fix] Fix HTTP maps updates
-rw-r--r-- | src/libutil/map.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libutil/map.c b/src/libutil/map.c index 35e0b9a27..b14b759b0 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -34,7 +34,6 @@ static void write_http_request (struct http_callback_data *cbd) { gchar datebuf[128]; - struct tm *tm; struct rspamd_http_message *msg; rspamd_mempool_t *pool; @@ -53,9 +52,8 @@ write_http_request (struct http_callback_data *cbd) msg->url = rspamd_fstring_new_init (cbd->data->path, strlen (cbd->data->path)); if (cbd->data->last_checked != 0 && cbd->stage == map_load_file) { - tm = gmtime (&cbd->data->last_checked); - strftime (datebuf, sizeof (datebuf), "%a, %d %b %Y %H:%M:%S %Z", tm); - + rspamd_http_date_format (datebuf, sizeof (datebuf), + cbd->data->last_checked); rspamd_http_message_add_header (msg, "If-Modified-Since", datebuf); } } @@ -398,7 +396,13 @@ http_map_finish (struct rspamd_http_connection *conn, else if (msg->code == 304 && cbd->stage == map_load_file) { msg_debug_pool ("data is not modified for server %s", cbd->data->host); - cbd->data->last_checked = msg->date; + + if (msg->last_modified) { + cbd->data->last_checked = msg->last_modified; + } + else { + cbd->data->last_checked = msg->date; + } } else { msg_info_pool ("cannot load map %s from %s: HTTP error %d", |