summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/opentracker.c b/opentracker.c
index 4ad42f0..051a67c 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -59,7 +59,6 @@ static char *accesslist_filename = NULL;
59 59
60static char static_inbuf[8192]; 60static char static_inbuf[8192];
61static char static_outbuf[8192]; 61static char static_outbuf[8192];
62static char static_tmpbuf[8192];
63 62
64#define OT_MAXMULTISCRAPE_COUNT 64 63#define OT_MAXMULTISCRAPE_COUNT 64
65static ot_hash multiscrape_buf[OT_MAXMULTISCRAPE_COUNT]; 64static ot_hash multiscrape_buf[OT_MAXMULTISCRAPE_COUNT];
@@ -227,7 +226,8 @@ static void httpresponse( const int64 s, char *data, size_t l ) {
227 size_t reply_size = 0, reply_off; 226 size_t reply_size = 0, reply_off;
228 227
229#ifdef _DEBUG_HTTPERROR 228#ifdef _DEBUG_HTTPERROR
230 memcpy( debug_request, data, sizeof( debug_request ) ); 229 memcpy( debug_request, data, l );
230 data[l] = 0;
231#endif 231#endif
232 232
233 /* This one implicitely tests strlen < 5, too -- remember, it is \n terminated */ 233 /* This one implicitely tests strlen < 5, too -- remember, it is \n terminated */
@@ -376,15 +376,13 @@ LOG_TO_STDERR( "stats: %d.%d.%d.%d - mode: s24s old\n", h->ip[0], h->ip[1], h->i
376 case 6: /* scrape ? */ 376 case 6: /* scrape ? */
377 if( byte_diff( data, 6, "scrape") ) HTTPERROR_404; 377 if( byte_diff( data, 6, "scrape") ) HTTPERROR_404;
378 378
379 /* We want the pure plain un-unescaped text */
380 memmove( static_tmpbuf, static_inbuf, 8192 );
381
382 /* Full scrape... you might want to limit that */ 379 /* Full scrape... you might want to limit that */
383 if( !byte_diff( data, 12, "scrape HTTP/" ) ) { 380 if( !byte_diff( data, 12, "scrape HTTP/" ) ) {
384 381
385LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE\n", (unsigned int)(g_now - ot_start_time), h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); 382LOG_TO_STDERR( "[%08d] scrp: %d.%d.%d.%d - FULL SCRAPE\n", (unsigned int)(g_now - ot_start_time), h->ip[0], h->ip[1], h->ip[2], h->ip[3] );
386write( 2, static_tmpbuf, l ); 383#ifdef _DEBUG_HTTPERROR
387 384write( 2, debug_request, l );
385#endif
388 if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500; 386 if( !( reply_size = return_fullscrape_for_tracker( &reply ) ) ) HTTPERROR_500;
389 ot_overall_tcp_successfulannounces++; 387 ot_overall_tcp_successfulannounces++;
390 return sendmmapdata( s, reply, reply_size ); 388 return sendmmapdata( s, reply, reply_size );