diff options
author | erdgeist <> | 2008-10-28 00:24:14 +0000 |
---|---|---|
committer | erdgeist <> | 2008-10-28 00:24:14 +0000 |
commit | 39ed6a058be7d21023470a3615f873527205785f (patch) | |
tree | 1f5159fac7d25efd27908ce8e684557a6b60f3a1 /ot_http.c | |
parent | 511a92e3212e7902d9a0f2fccc33f3c93055c2a8 (diff) |
Fix stats parse code to allow modes with more than 4 characters. Wir wurden ja langsam zum Gespoett der Leute.
Diffstat (limited to 'ot_http.c')
-rw-r--r-- | ot_http.c | 90 |
1 files changed, 52 insertions, 38 deletions
@@ -231,44 +231,58 @@ static ssize_t http_handle_stats( const int64 client_socket, char *data, char *d | |||
231 | scan_urlencoded_skipvalue( &c ); | 231 | scan_urlencoded_skipvalue( &c ); |
232 | continue; | 232 | continue; |
233 | } | 233 | } |
234 | if( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) != 4 ) HTTPERROR_400_PARAM; | 234 | switch( scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) { |
235 | if( !byte_diff(data,4,"peer")) | 235 | case 4: |
236 | mode = TASK_STATS_PEERS; | 236 | if( !byte_diff(data,4,"peer")) |
237 | else if( !byte_diff(data,4,"conn")) | 237 | mode = TASK_STATS_PEERS; |
238 | mode = TASK_STATS_CONNS; | 238 | else if( !byte_diff(data,4,"conn")) |
239 | else if( !byte_diff(data,4,"top10")) | 239 | mode = TASK_STATS_CONNS; |
240 | mode = TASK_STATS_TOP10; | 240 | else if( !byte_diff(data,4,"scrp")) |
241 | else if( !byte_diff(data,4,"scrp")) | 241 | mode = TASK_STATS_SCRAPE; |
242 | mode = TASK_STATS_SCRAPE; | 242 | else if( !byte_diff(data,4,"tcp4")) |
243 | else if( !byte_diff(data,4,"torr")) | 243 | mode = TASK_STATS_TCP; |
244 | mode = TASK_STATS_TORRENTS; | 244 | else if( !byte_diff(data,4,"udp4")) |
245 | else if( !byte_diff(data,4,"fscr")) | 245 | mode = TASK_STATS_UDP; |
246 | mode = TASK_STATS_FULLSCRAPE; | 246 | else if( !byte_diff(data,4,"busy")) |
247 | else if( !byte_diff(data,4,"tcp4")) | 247 | mode = TASK_STATS_BUSY_NETWORKS; |
248 | mode = TASK_STATS_TCP; | 248 | else if( !byte_diff(data,4,"dmem")) |
249 | else if( !byte_diff(data,4,"udp4")) | 249 | mode = TASK_STATS_MEMORY; |
250 | mode = TASK_STATS_UDP; | 250 | else if( !byte_diff(data,4,"vdeb")) |
251 | else if( !byte_diff(data,4,"s24s")) | 251 | mode = TASK_STATS_VECTOR_DEBUG; |
252 | mode = TASK_STATS_SLASH24S; | 252 | else if( !byte_diff(data,4,"torr")) |
253 | else if( !byte_diff(data,4,"tpbs")) | 253 | mode = TASK_STATS_TORRENTS; |
254 | mode = TASK_STATS_TPB; | 254 | else if( !byte_diff(data,4,"fscr")) |
255 | else if( !byte_diff(data,4,"herr")) | 255 | mode = TASK_STATS_FULLSCRAPE; |
256 | mode = TASK_STATS_HTTPERRORS; | 256 | else if( !byte_diff(data,4,"s24s")) |
257 | else if( !byte_diff(data,4,"startstop")) | 257 | mode = TASK_STATS_SLASH24S; |
258 | mode = TASK_STATS_STARTSTOP; | 258 | else if( !byte_diff(data,4,"tpbs")) |
259 | else if( !byte_diff(data,4,"toraddrem")) | 259 | mode = TASK_STATS_TPB; |
260 | mode = TASK_STATS_TORADDREM; | 260 | else if( !byte_diff(data,4,"herr")) |
261 | else if( !byte_diff(data,4,"vers")) | 261 | mode = TASK_STATS_HTTPERRORS; |
262 | mode = TASK_STATS_VERSION; | 262 | else |
263 | else if( !byte_diff(data,4,"busy")) | 263 | HTTPERROR_400_PARAM; |
264 | mode = TASK_STATS_BUSY_NETWORKS; | 264 | break; |
265 | else if( !byte_diff(data,4,"dmem")) | 265 | case 5: |
266 | mode = TASK_STATS_MEMORY; | 266 | if( !byte_diff(data,5,"top10")) |
267 | else if( !byte_diff(data,4,"vdeb")) | 267 | mode = TASK_STATS_TOP10; |
268 | mode = TASK_STATS_VECTOR_DEBUG; | 268 | else |
269 | else | 269 | HTTPERROR_400_PARAM; |
270 | HTTPERROR_400_PARAM; | 270 | break; |
271 | break; | 271 | case 7: |
272 | if( !byte_diff(data,7,"version")) | ||
273 | mode = TASK_STATS_VERSION; | ||
274 | else | ||
275 | HTTPERROR_400_PARAM; | ||
276 | break; | ||
277 | case 9: | ||
278 | if( !byte_diff(data,9,"startstop")) | ||
279 | mode = TASK_STATS_STARTSTOP; | ||
280 | else if( !byte_diff(data,9,"toraddrem")) | ||
281 | mode = TASK_STATS_TORADDREM; | ||
282 | else | ||
283 | HTTPERROR_400_PARAM; | ||
284 | break; | ||
285 | } | ||
272 | case 6: | 286 | case 6: |
273 | if( byte_diff(data,6,"format")) { | 287 | if( byte_diff(data,6,"format")) { |
274 | scan_urlencoded_skipvalue( &c ); | 288 | scan_urlencoded_skipvalue( &c ); |