Fix stats parse code to allow modes with more than 4 characters. Wir wurden ja langsam zum Gespoett der Leute.

dynamic-accesslists
erdgeist 16 years ago
parent 511a92e321
commit 39ed6a058b

@ -231,44 +231,58 @@ static ssize_t http_handle_stats( const int64 client_socket, char *data, char *d
scan_urlencoded_skipvalue( &c ); scan_urlencoded_skipvalue( &c );
continue; continue;
} }
if( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) != 4 ) HTTPERROR_400_PARAM; switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) {
if( !byte_diff(data,4,"peer")) case 4:
mode = TASK_STATS_PEERS; if( !byte_diff(data,4,"peer"))
else if( !byte_diff(data,4,"conn")) mode = TASK_STATS_PEERS;
mode = TASK_STATS_CONNS; else if( !byte_diff(data,4,"conn"))
else if( !byte_diff(data,4,"top10")) mode = TASK_STATS_CONNS;
mode = TASK_STATS_TOP10; else if( !byte_diff(data,4,"scrp"))
else if( !byte_diff(data,4,"scrp")) mode = TASK_STATS_SCRAPE;
mode = TASK_STATS_SCRAPE; else if( !byte_diff(data,4,"tcp4"))
else if( !byte_diff(data,4,"torr")) mode = TASK_STATS_TCP;
mode = TASK_STATS_TORRENTS; else if( !byte_diff(data,4,"udp4"))
else if( !byte_diff(data,4,"fscr")) mode = TASK_STATS_UDP;
mode = TASK_STATS_FULLSCRAPE; else if( !byte_diff(data,4,"busy"))
else if( !byte_diff(data,4,"tcp4")) mode = TASK_STATS_BUSY_NETWORKS;
mode = TASK_STATS_TCP; else if( !byte_diff(data,4,"dmem"))
else if( !byte_diff(data,4,"udp4")) mode = TASK_STATS_MEMORY;
mode = TASK_STATS_UDP; else if( !byte_diff(data,4,"vdeb"))
else if( !byte_diff(data,4,"s24s")) mode = TASK_STATS_VECTOR_DEBUG;
mode = TASK_STATS_SLASH24S; else if( !byte_diff(data,4,"torr"))
else if( !byte_diff(data,4,"tpbs")) mode = TASK_STATS_TORRENTS;
mode = TASK_STATS_TPB; else if( !byte_diff(data,4,"fscr"))
else if( !byte_diff(data,4,"herr")) mode = TASK_STATS_FULLSCRAPE;
mode = TASK_STATS_HTTPERRORS; else if( !byte_diff(data,4,"s24s"))
else if( !byte_diff(data,4,"startstop")) mode = TASK_STATS_SLASH24S;
mode = TASK_STATS_STARTSTOP; else if( !byte_diff(data,4,"tpbs"))
else if( !byte_diff(data,4,"toraddrem")) mode = TASK_STATS_TPB;
mode = TASK_STATS_TORADDREM; else if( !byte_diff(data,4,"herr"))
else if( !byte_diff(data,4,"vers")) mode = TASK_STATS_HTTPERRORS;
mode = TASK_STATS_VERSION; else
else if( !byte_diff(data,4,"busy")) HTTPERROR_400_PARAM;
mode = TASK_STATS_BUSY_NETWORKS; break;
else if( !byte_diff(data,4,"dmem")) case 5:
mode = TASK_STATS_MEMORY; if( !byte_diff(data,5,"top10"))
else if( !byte_diff(data,4,"vdeb")) mode = TASK_STATS_TOP10;
mode = TASK_STATS_VECTOR_DEBUG; else
else HTTPERROR_400_PARAM;
HTTPERROR_400_PARAM; break;
break; case 7:
if( !byte_diff(data,7,"version"))
mode = TASK_STATS_VERSION;
else
HTTPERROR_400_PARAM;
break;
case 9:
if( !byte_diff(data,9,"startstop"))
mode = TASK_STATS_STARTSTOP;
else if( !byte_diff(data,9,"toraddrem"))
mode = TASK_STATS_TORADDREM;
else
HTTPERROR_400_PARAM;
break;
}
case 6: case 6:
if( byte_diff(data,6,"format")) { if( byte_diff(data,6,"format")) {
scan_urlencoded_skipvalue( &c ); scan_urlencoded_skipvalue( &c );

Loading…
Cancel
Save