diff options
author | erdgeist <> | 2007-10-18 23:33:07 +0000 |
---|---|---|
committer | erdgeist <> | 2007-10-18 23:33:07 +0000 |
commit | b86e6382a1d496cdb2acb0b85732c644de3add11 (patch) | |
tree | f9a169f692b59201cee2fa73cd993a90f83e902d /opentracker.c | |
parent | dba3bb3ae7957773f9799a14d6f7b47f08b7c03b (diff) |
Save a lot of work when skipping through uninteresting http request parameters
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/opentracker.c b/opentracker.c index b77773d..380168e 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -237,10 +237,10 @@ LOG_TO_STDERR( "sync: %d.%d.%d.%d\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); | |||
237 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { | 237 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { |
238 | case -2: scanon = 0; break; /* TERMINATOR */ | 238 | case -2: scanon = 0; break; /* TERMINATOR */ |
239 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ | 239 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ |
240 | default: scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); break; | 240 | default: scan_urlencoded_skipvalue( &c ); break; |
241 | case 9: | 241 | case 9: |
242 | if(byte_diff(data,9,"changeset")) { | 242 | if(byte_diff(data,9,"changeset")) { |
243 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 243 | scan_urlencoded_skipvalue( &c ); |
244 | continue; | 244 | continue; |
245 | } | 245 | } |
246 | /* ignore this, when we dont at least see "d4:syncdee" */ | 246 | /* ignore this, when we dont at least see "d4:syncdee" */ |
@@ -273,10 +273,10 @@ LOG_TO_STDERR( "sync: %d.%d.%d.%d\n", h->ip[0], h->ip[1], h->ip[2], h->ip[3] ); | |||
273 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { | 273 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { |
274 | case -2: scanon = 0; break; /* TERMINATOR */ | 274 | case -2: scanon = 0; break; /* TERMINATOR */ |
275 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ | 275 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ |
276 | default: scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); break; | 276 | default: scan_urlencoded_skipvalue( &c ); break; |
277 | case 4: | 277 | case 4: |
278 | if( byte_diff(data,4,"mode")) { | 278 | if( byte_diff(data,4,"mode")) { |
279 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 279 | scan_urlencoded_skipvalue( &c ); |
280 | continue; | 280 | continue; |
281 | } | 281 | } |
282 | if( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) != 4 ) HTTPERROR_400_PARAM; | 282 | if( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) != 4 ) HTTPERROR_400_PARAM; |
@@ -362,10 +362,10 @@ SCRAPE_WORKAROUND: | |||
362 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { | 362 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { |
363 | case -2: scanon = 0; break; /* TERMINATOR */ | 363 | case -2: scanon = 0; break; /* TERMINATOR */ |
364 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ | 364 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ |
365 | default: scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); break; | 365 | default: scan_urlencoded_skipvalue( &c ); break; |
366 | case 9: | 366 | case 9: |
367 | if(byte_diff(data,9,"info_hash")) { | 367 | if(byte_diff(data,9,"info_hash")) { |
368 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 368 | scan_urlencoded_skipvalue( &c ); |
369 | continue; | 369 | continue; |
370 | } | 370 | } |
371 | /* ignore this, when we have less than 20 bytes */ | 371 | /* ignore this, when we have less than 20 bytes */ |
@@ -407,7 +407,7 @@ ANNOUNCE_WORKAROUND: | |||
407 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { | 407 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_PARAM ) ) { |
408 | case -2: scanon = 0; break; /* TERMINATOR */ | 408 | case -2: scanon = 0; break; /* TERMINATOR */ |
409 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ | 409 | case -1: HTTPERROR_400_PARAM; /* PARSE ERROR */ |
410 | default: scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); break; | 410 | default: scan_urlencoded_skipvalue( &c ); break; |
411 | #ifdef WANT_IP_FROM_QUERY_STRING | 411 | #ifdef WANT_IP_FROM_QUERY_STRING |
412 | case 2: | 412 | case 2: |
413 | if(!byte_diff(data,2,"ip")) { | 413 | if(!byte_diff(data,2,"ip")) { |
@@ -416,7 +416,7 @@ ANNOUNCE_WORKAROUND: | |||
416 | if( ( len <= 0 ) || scan_fixed_ip( data, len, ip ) ) HTTPERROR_400_PARAM; | 416 | if( ( len <= 0 ) || scan_fixed_ip( data, len, ip ) ) HTTPERROR_400_PARAM; |
417 | OT_SETIP( &peer, ip ); | 417 | OT_SETIP( &peer, ip ); |
418 | } else | 418 | } else |
419 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 419 | scan_urlencoded_skipvalue( &c ); |
420 | break; | 420 | break; |
421 | #endif | 421 | #endif |
422 | case 4: | 422 | case 4: |
@@ -429,11 +429,11 @@ ANNOUNCE_WORKAROUND: | |||
429 | if( scan_fixed_int( data, len, &tmp ) ) tmp = 0; | 429 | if( scan_fixed_int( data, len, &tmp ) ) tmp = 0; |
430 | if( !tmp ) OT_FLAG( &peer ) |= PEER_FLAG_SEEDING; | 430 | if( !tmp ) OT_FLAG( &peer ) |= PEER_FLAG_SEEDING; |
431 | } else | 431 | } else |
432 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 432 | scan_urlencoded_skipvalue( &c ); |
433 | break; | 433 | break; |
434 | case 5: | 434 | case 5: |
435 | if( byte_diff( data, 5, "event" ) ) | 435 | if( byte_diff( data, 5, "event" ) ) |
436 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 436 | scan_urlencoded_skipvalue( &c ); |
437 | else switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) { | 437 | else switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) { |
438 | case -1: | 438 | case -1: |
439 | HTTPERROR_400_PARAM; | 439 | HTTPERROR_400_PARAM; |
@@ -456,11 +456,11 @@ ANNOUNCE_WORKAROUND: | |||
456 | 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; |
457 | if( !tmp ) HTTPERROR_400_COMPACT; | 457 | if( !tmp ) HTTPERROR_400_COMPACT; |
458 | } else | 458 | } else |
459 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 459 | scan_urlencoded_skipvalue( &c ); |
460 | break; | 460 | break; |
461 | case 9: | 461 | case 9: |
462 | if(byte_diff(data,9,"info_hash")) { | 462 | if(byte_diff(data,9,"info_hash")) { |
463 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | 463 | scan_urlencoded_skipvalue( &c ); |
464 | continue; | 464 | continue; |
465 | } | 465 | } |
466 | /* ignore this, when we have less than 20 bytes */ | 466 | /* ignore this, when we have less than 20 bytes */ |