diff options
Diffstat (limited to 'ot_http.c')
| -rw-r--r-- | ot_http.c | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -44,7 +44,7 @@ ssize_t g_stats_path_len; | |||
| 44 | 44 | ||
| 45 | enum { SUCCESS_HTTP_HEADER_LENGTH = 80, SUCCESS_HTTP_SIZE_OFF = 17 }; | 45 | enum { SUCCESS_HTTP_HEADER_LENGTH = 80, SUCCESS_HTTP_SIZE_OFF = 17 }; |
| 46 | 46 | ||
| 47 | static void http_senddata(const int64 sock, struct ot_workstruct *ws) { | 47 | static void http_senddata(const int64_t sock, struct ot_workstruct *ws) { |
| 48 | struct http_data *cookie = io_getcookie(sock); | 48 | struct http_data *cookie = io_getcookie(sock); |
| 49 | ssize_t written_size; | 49 | ssize_t written_size; |
| 50 | 50 | ||
| @@ -124,7 +124,7 @@ static void http_senddata(const int64 sock, struct ot_workstruct *ws) { | |||
| 124 | #define HTTPERROR_403_IP return http_issue_error(sock, ws, CODE_HTTPERROR_403_IP) | 124 | #define HTTPERROR_403_IP return http_issue_error(sock, ws, CODE_HTTPERROR_403_IP) |
| 125 | #define HTTPERROR_404 return http_issue_error(sock, ws, CODE_HTTPERROR_404) | 125 | #define HTTPERROR_404 return http_issue_error(sock, ws, CODE_HTTPERROR_404) |
| 126 | #define HTTPERROR_500 return http_issue_error(sock, ws, CODE_HTTPERROR_500) | 126 | #define HTTPERROR_500 return http_issue_error(sock, ws, CODE_HTTPERROR_500) |
| 127 | ssize_t http_issue_error(const int64 sock, struct ot_workstruct *ws, int code) { | 127 | ssize_t http_issue_error(const int64_t sock, struct ot_workstruct *ws, int code) { |
| 128 | char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required", | 128 | char *error_code[] = {"302 Found", "400 Invalid Request", "400 Invalid Request", "400 Invalid Request", "402 Payment Required", |
| 129 | "403 Not Modest", "403 Access Denied", "404 Not Found", "500 Internal Server Error"}; | 129 | "403 Not Modest", "403 Access Denied", "404 Not Found", "500 Internal Server Error"}; |
| 130 | char *title = error_code[code]; | 130 | char *title = error_code[code]; |
| @@ -144,7 +144,7 @@ ssize_t http_issue_error(const int64 sock, struct ot_workstruct *ws, int code) { | |||
| 144 | return ws->reply_size = -2; | 144 | return ws->reply_size = -2; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | ssize_t http_sendiovecdata(const int64 sock, struct ot_workstruct *ws, size_t iovec_entries, struct iovec *iovector, int is_partial) { | 147 | ssize_t http_sendiovecdata(const int64_t sock, struct ot_workstruct *ws, size_t iovec_entries, struct iovec *iovector, int is_partial) { |
| 148 | struct http_data *cookie = io_getcookie(sock); | 148 | struct http_data *cookie = io_getcookie(sock); |
| 149 | io_batch *current; | 149 | io_batch *current; |
| 150 | char *header; | 150 | char *header; |
| @@ -243,7 +243,7 @@ ssize_t http_sendiovecdata(const int64 sock, struct ot_workstruct *ws, size_t io | |||
| 243 | return 0; | 243 | return 0; |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | static ssize_t http_handle_stats(const int64 sock, struct ot_workstruct *ws, char *read_ptr) { | 246 | static ssize_t http_handle_stats(const int64_t sock, struct ot_workstruct *ws, char *read_ptr) { |
| 247 | static const ot_keywords keywords_main[] = {{"mode", 1}, {"format", 2}, {"info_hash", 3}, {NULL, -3}}; | 247 | static const ot_keywords keywords_main[] = {{"mode", 1}, {"format", 2}, {"info_hash", 3}, {NULL, -3}}; |
| 248 | static const ot_keywords keywords_mode[] = {{"peer", TASK_STATS_PEERS}, | 248 | static const ot_keywords keywords_mode[] = {{"peer", TASK_STATS_PEERS}, |
| 249 | {"conn", TASK_STATS_CONNS}, | 249 | {"conn", TASK_STATS_CONNS}, |
| @@ -368,7 +368,7 @@ typedef struct { | |||
| 368 | #endif | 368 | #endif |
| 369 | 369 | ||
| 370 | #ifdef WANT_FULLSCRAPE | 370 | #ifdef WANT_FULLSCRAPE |
| 371 | static ssize_t http_handle_fullscrape(const int64 sock, struct ot_workstruct *ws) { | 371 | static ssize_t http_handle_fullscrape(const int64_t sock, struct ot_workstruct *ws) { |
| 372 | struct http_data *cookie = io_getcookie(sock); | 372 | struct http_data *cookie = io_getcookie(sock); |
| 373 | int format = 0; | 373 | int format = 0; |
| 374 | tai6464 t; | 374 | tai6464 t; |
| @@ -438,7 +438,7 @@ static ssize_t http_handle_fullscrape(const int64 sock, struct ot_workstruct *ws | |||
| 438 | } | 438 | } |
| 439 | #endif | 439 | #endif |
| 440 | 440 | ||
| 441 | static ssize_t http_handle_scrape(const int64 sock, struct ot_workstruct *ws, char *read_ptr) { | 441 | static ssize_t http_handle_scrape(const int64_t sock, struct ot_workstruct *ws, char *read_ptr) { |
| 442 | static const ot_keywords keywords_scrape[] = {{"info_hash", 1}, {NULL, -3}}; | 442 | static const ot_keywords keywords_scrape[] = {{"info_hash", 1}, {NULL, -3}}; |
| 443 | 443 | ||
| 444 | ot_hash *multiscrape_buf = (ot_hash *)ws->request; | 444 | ot_hash *multiscrape_buf = (ot_hash *)ws->request; |
| @@ -517,7 +517,7 @@ static ot_keywords keywords_announce[] = {{"port", 1}, {"left", 2}, {"event", | |||
| 517 | #endif | 517 | #endif |
| 518 | {"peer_id", 9}, {NULL, -3}}; | 518 | {"peer_id", 9}, {NULL, -3}}; |
| 519 | static ot_keywords keywords_announce_event[] = {{"completed", 1}, {"stopped", 2}, {NULL, -3}}; | 519 | static ot_keywords keywords_announce_event[] = {{"completed", 1}, {"stopped", 2}, {NULL, -3}}; |
| 520 | static ssize_t http_handle_announce(const int64 sock, struct ot_workstruct *ws, char *read_ptr) { | 520 | static ssize_t http_handle_announce(const int64_t sock, struct ot_workstruct *ws, char *read_ptr) { |
| 521 | size_t numwant; | 521 | size_t numwant; |
| 522 | int tmp, scanon; | 522 | int tmp, scanon; |
| 523 | unsigned short port = 0; | 523 | unsigned short port = 0; |
| @@ -695,7 +695,7 @@ static ssize_t http_handle_announce(const int64 sock, struct ot_workstruct * | |||
| 695 | return ws->reply_size; | 695 | return ws->reply_size; |
| 696 | } | 696 | } |
| 697 | 697 | ||
| 698 | ssize_t http_handle_request(const int64 sock, struct ot_workstruct *ws) { | 698 | ssize_t http_handle_request(const int64_t sock, struct ot_workstruct *ws) { |
| 699 | ssize_t reply_off, len; | 699 | ssize_t reply_off, len; |
| 700 | char *read_ptr = ws->request, *write_ptr; | 700 | char *read_ptr = ws->request, *write_ptr; |
| 701 | 701 | ||
