summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ot_http.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/ot_http.c b/ot_http.c
index 5bcc725..ee76639 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -41,6 +41,11 @@ static char static_outbuf[8192];
41static char debug_request[8192]; 41static char debug_request[8192];
42#endif 42#endif
43 43
44#ifdef _DEBUG_PEERID
45size_t g_this_peerid_len = 0;
46char *g_this_peerid_data = NULL;
47#endif
48
44static void http_senddata( const int64 client_socket, char *buffer, size_t size ) { 49static 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: