mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
bwauth: check if a bw file could be read
Before serving it by HTTP.
This commit is contained in:
parent
ee09e5d7ea
commit
b75e2539f9
1 changed files with 8 additions and 6 deletions
|
@ -1453,13 +1453,15 @@ handle_get_next_bandwidth(dir_connection_t *conn,
|
||||||
int lifetime = 60;
|
int lifetime = 60;
|
||||||
char *bandwidth = read_file_to_str(options->V3BandwidthsFile,
|
char *bandwidth = read_file_to_str(options->V3BandwidthsFile,
|
||||||
RFTS_IGNORE_MISSING, NULL);
|
RFTS_IGNORE_MISSING, NULL);
|
||||||
size_t len = strlen(bandwidth);
|
if (bandwidth != NULL) {
|
||||||
write_http_response_header(conn, len, NO_METHOD, lifetime);
|
site_t len = strlen(bandwidth);
|
||||||
connection_buf_add(bandwidth, len, TO_CONN(conn));
|
write_http_response_header(conn, len, NO_METHOD, lifetime);
|
||||||
tor_free(bandwidth);
|
connection_buf_add(bandwidth, len, TO_CONN(conn));
|
||||||
} else {
|
tor_free(bandwidth);
|
||||||
write_short_http_response(conn, 404, "Not found");
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
write_short_http_response(conn, 404, "Not found");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue