diff options
author | erdgeist <> | 2008-12-03 20:40:25 +0000 |
---|---|---|
committer | erdgeist <> | 2008-12-03 20:40:25 +0000 |
commit | 2c7c10138bb2c990b0248b805ea282f7f159dc89 (patch) | |
tree | d0e3a791d5bc5e724dcf2f669c7a3d5c812a5c96 /ot_http.c | |
parent | e2199cc5046fc3e7cf0775948520258e844f6d59 (diff) |
Add debug code to store peer id
Diffstat (limited to 'ot_http.c')
-rw-r--r-- | ot_http.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -41,6 +41,11 @@ static char static_outbuf[8192]; | |||
41 | static char debug_request[8192]; | 41 | static char debug_request[8192]; |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #ifdef _DEBUG_PEERID | ||
45 | size_t g_this_peerid_len = 0; | ||
46 | char *g_this_peerid_data = NULL; | ||
47 | #endif | ||
48 | |||
44 | static void http_senddata( const int64 client_socket, char *buffer, size_t size ) { | 49 | static void http_senddata( const int64 client_socket, char *buffer, size_t size ) { |
45 | struct http_data *h = io_getcookie( client_socket ); | 50 | struct http_data *h = io_getcookie( client_socket ); |
46 | ssize_t written_size; | 51 | ssize_t written_size; |
@@ -154,8 +159,7 @@ ssize_t http_sendiovecdata( const int64 client_socket, int iovec_entries, struct | |||
154 | 159 | ||
155 | h->flag |= STRUCT_HTTP_FLAG_IOB_USED; | 160 | h->flag |= STRUCT_HTTP_FLAG_IOB_USED; |
156 | 161 | ||
157 | /* writeable sockets timeout after twice the pool timeout | 162 | /* writeable sockets timeout after 10 minutes) */ |
158 | which defaults to 5 minutes (e.g. after 10 minutes) */ | ||
159 | taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND ); | 163 | taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND ); |
160 | io_timeout( client_socket, t ); | 164 | io_timeout( client_socket, t ); |
161 | io_dontwantread( client_socket ); | 165 | io_dontwantread( client_socket ); |
@@ -169,7 +173,7 @@ static ssize_t http_handle_stats( const int64 client_socket, char *data, char *d | |||
169 | #ifdef WANT_RESTRICT_STATS | 173 | #ifdef WANT_RESTRICT_STATS |
170 | struct http_data *h = io_getcookie( client_socket ); | 174 | struct http_data *h = io_getcookie( client_socket ); |
171 | 175 | ||
172 | if( !accesslist_isblessed( h->ip, OT_PERMISSION_MAY_STAT ) ) | 176 | if( !h || !accesslist_isblessed( h->ip, OT_PERMISSION_MAY_STAT ) ) |
173 | HTTPERROR_403_IP; | 177 | HTTPERROR_403_IP; |
174 | #endif | 178 | #endif |
175 | 179 | ||
@@ -452,6 +456,12 @@ static ssize_t http_handle_announce( const int64 client_socket, char *data ) { | |||
452 | if( ( len <= 0 ) || scan_fixed_int( data, len, &tmp ) ) HTTPERROR_400_PARAM; | 456 | if( ( len <= 0 ) || scan_fixed_int( data, len, &tmp ) ) HTTPERROR_400_PARAM; |
453 | if( !tmp ) HTTPERROR_400_COMPACT; | 457 | if( !tmp ) HTTPERROR_400_COMPACT; |
454 | } else | 458 | } else |
459 | #ifdef _DEBUG_PEERID | ||
460 | if(!byte_diff(data,7,"peer_id")) { | ||
461 | g_this_peerid_len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ); | ||
462 | g_this_peerid_data = g_this_peerid_len > 0 ? data : 0; | ||
463 | } else | ||
464 | #endif | ||
455 | scan_urlencoded_skipvalue( &c ); | 465 | scan_urlencoded_skipvalue( &c ); |
456 | break; | 466 | break; |
457 | case 9: | 467 | case 9: |