summaryrefslogtreecommitdiff
path: root/opentracker.c
diff options
context:
space:
mode:
Diffstat (limited to 'opentracker.c')
-rw-r--r--opentracker.c13
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 ) ) {