diff options
author | erdgeist <> | 2007-10-19 15:37:00 +0000 |
---|---|---|
committer | erdgeist <> | 2007-10-19 15:37:00 +0000 |
commit | 1b0859411e0b8cd217c2ede83c400c16cd58bd3d (patch) | |
tree | 0f063dedd533382f8c532164a452e9fa917a0013 /opentracker.c | |
parent | daf79f694d7e00395697fa84ab1b529ac44b3ab1 (diff) |
be more verbose about what full scrape consumers deliver in their http requests
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/opentracker.c b/opentracker.c index caa1312..191d5d6 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -88,7 +88,7 @@ struct http_data { | |||
88 | int main( int argc, char **argv ); | 88 | int main( int argc, char **argv ); |
89 | 89 | ||
90 | static void httperror( const int64 s, const char *title, const char *message ); | 90 | static void httperror( const int64 s, const char *title, const char *message ); |
91 | static void httpresponse( const int64 s, char *data ); | 91 | static void httpresponse( const int64 s, char *data, size_t l ); |
92 | 92 | ||
93 | static void sendmmapdata( const int64 s, char *buffer, const size_t size ); | 93 | static void sendmmapdata( const int64 s, char *buffer, const size_t size ); |
94 | static void senddata( const int64 s, char *buffer, const size_t size ); | 94 | static void senddata( const int64 s, char *buffer, const size_t size ); |
@@ -210,7 +210,7 @@ static void senddata( const int64 s, char *buffer, size_t size ) { | |||
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | static void httpresponse( const int64 s, char *data ) { | 213 | static void httpresponse( const int64 s, char *data, size_t l ) { |
214 | struct http_data* h = io_getcookie( s ); | 214 | struct http_data* h = io_getcookie( s ); |
215 | char *c, *reply; | 215 | char *c, *reply; |
216 | ot_peer peer; | 216 | ot_peer peer; |
@@ -395,7 +395,9 @@ SCRAPE_WORKAROUND: | |||
395 | /* Scanned whole query string, no hash means full scrape... you might want to limit that */ | 395 | /* Scanned whole query string, no hash means full scrape... you might want to limit that */ |
396 | if( !hash ) { | 396 | if( !hash ) { |
397 | LOG_TO_STDERR( "scrp: %d.%d.%d.%d - FULL SCRAPE\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); | 397 | LOG_TO_STDERR( "scrp: %d.%d.%d.%d - FULL SCRAPE\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); |
398 | 398 | LOG_TO_STDERR( "GET /scrape" ); | |
399 | write( 2, data, l-12 ); | ||
400 | write( 2, "\n", 1 ); | ||
399 | if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500; | 401 | if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500; |
400 | ot_overall_tcp_successfulannounces++; | 402 | ot_overall_tcp_successfulannounces++; |
401 | return sendmmapdata( s, reply, reply_size ); | 403 | return sendmmapdata( s, reply, reply_size ); |
@@ -599,7 +601,7 @@ static void handle_read( const int64 clientsocket ) { | |||
599 | /* If we get the whole request in one packet, handle it without copying */ | 601 | /* If we get the whole request in one packet, handle it without copying */ |
600 | if( !array_start( &h->request ) ) { | 602 | if( !array_start( &h->request ) ) { |
601 | if( memchr( static_inbuf, '\n', l ) ) | 603 | if( memchr( static_inbuf, '\n', l ) ) |
602 | return httpresponse( clientsocket, static_inbuf ); | 604 | return httpresponse( clientsocket, static_inbuf, l ); |
603 | h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED; | 605 | h->flag |= STRUCT_HTTP_FLAG_ARRAY_USED; |
604 | return array_catb( &h->request, static_inbuf, l ); | 606 | return array_catb( &h->request, static_inbuf, l ); |
605 | } | 607 | } |
@@ -614,7 +616,7 @@ static void handle_read( const int64 clientsocket ) { | |||
614 | return httperror( clientsocket, "500 request too long", "You sent too much headers"); | 616 | return httperror( clientsocket, "500 request too long", "You sent too much headers"); |
615 | 617 | ||
616 | if( memchr( array_start( &h->request ), '\n', array_length( &h->request, 1 ) ) ) | 618 | if( memchr( array_start( &h->request ), '\n', array_length( &h->request, 1 ) ) ) |
617 | return httpresponse( clientsocket, array_start( &h->request ) ); | 619 | return httpresponse( clientsocket, array_start( &h->request ), array_length( &h->request, 1 ) ); |
618 | } | 620 | } |
619 | 621 | ||
620 | static void handle_write( const int64 clientsocket ) { | 622 | static void handle_write( const int64 clientsocket ) { |