diff options
author | erdgeist <> | 2007-01-03 05:11:48 +0000 |
---|---|---|
committer | erdgeist <> | 2007-01-03 05:11:48 +0000 |
commit | e0a9c2a4aa4fc6b648ae20071c35797c4a103e42 (patch) | |
tree | 246048aacb395db5c747fc4da260d6abf1f9b99f /opentracker.c | |
parent | f40b373c3b289687872269e4b931ada7044dc0d2 (diff) |
Added option to get ip from query string + parser, fixed two bugs concerning grow/shrink of vectors. Now cleans up a torrent BEFORE trying to remove a peer -> this may remove peer already and must be done anyway.
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c index a1f0311..680caa4 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -186,6 +186,17 @@ e400: | |||
186 | break; | 186 | break; |
187 | case -1: /* error */ | 187 | case -1: /* error */ |
188 | goto e404; | 188 | goto e404; |
189 | #ifdef WANT_IP_FROM_QUERY_STRING | ||
190 | case 2: | ||
191 | if(!byte_diff(data,2,"ip")) { | ||
192 | size_t len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ); | ||
193 | unsigned char ip[4]; | ||
194 | if( ( len <= 0 ) || scan_fixed_ip( data, len, ip ) ) goto e404; | ||
195 | OT_SETIP ( &peer, ip ); | ||
196 | } else | ||
197 | scan_urlencoded_query( &c, NULL, SCAN_SEARCHPATH_VALUE ); | ||
198 | break; | ||
199 | #endif | ||
189 | case 4: | 200 | case 4: |
190 | if(!byte_diff(data,4,"port")) { | 201 | if(!byte_diff(data,4,"port")) { |
191 | size_t len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ); | 202 | size_t len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ); |
@@ -263,7 +274,7 @@ e500: | |||
263 | httperror(h,"500 Internal Server Error","A server error has occured. Please retry later."); | 274 | httperror(h,"500 Internal Server Error","A server error has occured. Please retry later."); |
264 | goto bailout; | 275 | goto bailout; |
265 | } | 276 | } |
266 | reply = malloc( SUCCESS_HTTP_HEADER_LENGTH + numwant*6 + 128 ); // http header + peerlist + seeder, peers and lametta 80 + n*6+81 a.t.m. | 277 | reply = malloc( SUCCESS_HTTP_HEADER_LENGTH + numwant * 6 + 128 ); // http header + peerlist + seeder, peers and lametta 80 + n*6+81 a.t.m. |
267 | if( reply ) | 278 | if( reply ) |
268 | reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + reply ); | 279 | reply_size = return_peers_for_torrent( torrent, numwant, SUCCESS_HTTP_HEADER_LENGTH + reply ); |
269 | if( !reply || ( reply_size <= 0 ) ) { | 280 | if( !reply || ( reply_size <= 0 ) ) { |