mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Hack: Include date with successful directory GETs.
svn:r2130
This commit is contained in:
parent
14d5478f29
commit
630e1e4b44
@ -498,6 +498,7 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
|||||||
const char *cp;
|
const char *cp;
|
||||||
char *url;
|
char *url;
|
||||||
char tmp[8192];
|
char tmp[8192];
|
||||||
|
char date[RFC1123_TIME_LEN+1];
|
||||||
|
|
||||||
log_fn(LOG_DEBUG,"Received GET command.");
|
log_fn(LOG_DEBUG,"Received GET command.");
|
||||||
|
|
||||||
@ -537,7 +538,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
|
tor_format_rfc1123_time(date, time(NULL));
|
||||||
|
snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: text/plain\r\n\r\n",
|
||||||
|
date,
|
||||||
(int)dlen);
|
(int)dlen);
|
||||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||||
connection_write_to_buf(cp, strlen(cp), conn);
|
connection_write_to_buf(cp, strlen(cp), conn);
|
||||||
@ -560,7 +563,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
|||||||
}
|
}
|
||||||
switch(rend_cache_lookup_desc(url+strlen(rend_fetch_url), &descp, &desc_len)) {
|
switch(rend_cache_lookup_desc(url+strlen(rend_fetch_url), &descp, &desc_len)) {
|
||||||
case 1: /* valid */
|
case 1: /* valid */
|
||||||
snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
|
tor_format_rfc1123_time(date, time(NULL));
|
||||||
|
snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
|
||||||
|
date,
|
||||||
desc_len); /* can't include descp here, because it's got nuls */
|
desc_len); /* can't include descp here, because it's got nuls */
|
||||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||||
connection_write_to_buf(descp, desc_len, conn);
|
connection_write_to_buf(descp, desc_len, conn);
|
||||||
|
Loading…
Reference in New Issue
Block a user