summaryrefslogtreecommitdiff
path: root/ot_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_http.c')
-rw-r--r--ot_http.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ot_http.c b/ot_http.c
index aa4b3b3..d66fc80 100644
--- a/ot_http.c
+++ b/ot_http.c
@@ -399,7 +399,7 @@ static ssize_t http_handle_announce( const int64 client_socket, char *data ) {
399 399
400 OT_SETIP( &peer, ((struct http_data*)io_getcookie( client_socket ) )->ip ); 400 OT_SETIP( &peer, ((struct http_data*)io_getcookie( client_socket ) )->ip );
401 OT_SETPORT( &peer, &port ); 401 OT_SETPORT( &peer, &port );
402 OT_FLAG( &peer ) = 0; 402 OT_PEERFLAG( &peer ) = 0;
403 numwant = 50; 403 numwant = 50;
404 scanon = 1; 404 scanon = 1;
405 405
@@ -427,7 +427,7 @@ static ssize_t http_handle_announce( const int64 client_socket, char *data ) {
427 } else if( !byte_diff( data, 4, "left" ) ) { 427 } else if( !byte_diff( data, 4, "left" ) ) {
428 if( ( len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) <= 0 ) HTTPERROR_400_PARAM; 428 if( ( len = scan_urlencoded_query( &c, data = c, SCAN_SEARCHPATH_VALUE ) ) <= 0 ) HTTPERROR_400_PARAM;
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_PEERFLAG( &peer ) |= PEER_FLAG_SEEDING;
431 } else 431 } else
432 scan_urlencoded_skipvalue( &c ); 432 scan_urlencoded_skipvalue( &c );
433 break; 433 break;
@@ -438,10 +438,10 @@ static ssize_t http_handle_announce( const int64 client_socket, char *data ) {
438 case -1: 438 case -1:
439 HTTPERROR_400_PARAM; 439 HTTPERROR_400_PARAM;
440 case 7: 440 case 7:
441 if( !byte_diff( data, 7, "stopped" ) ) OT_FLAG( &peer ) |= PEER_FLAG_STOPPED; 441 if( !byte_diff( data, 7, "stopped" ) ) OT_PEERFLAG( &peer ) |= PEER_FLAG_STOPPED;
442 break; 442 break;
443 case 9: 443 case 9:
444 if( !byte_diff( data, 9, "completed" ) ) OT_FLAG( &peer ) |= PEER_FLAG_COMPLETED; 444 if( !byte_diff( data, 9, "completed" ) ) OT_PEERFLAG( &peer ) |= PEER_FLAG_COMPLETED;
445 default: /* Fall through intended */ 445 default: /* Fall through intended */
446 break; 446 break;
447 } 447 }
@@ -481,7 +481,7 @@ static ssize_t http_handle_announce( const int64 client_socket, char *data ) {
481 if( !hash ) 481 if( !hash )
482 return sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, "d14:failure reason80:Your client forgot to send your torrent's info_hash. Please upgrade your client.e" ); 482 return sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, "d14:failure reason80:Your client forgot to send your torrent's info_hash. Please upgrade your client.e" );
483 483
484 if( OT_FLAG( &peer ) & PEER_FLAG_STOPPED ) 484 if( OT_PEERFLAG( &peer ) & PEER_FLAG_STOPPED )
485 len = remove_peer_from_torrent( hash, &peer, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, FLAG_TCP ); 485 len = remove_peer_from_torrent( hash, &peer, SUCCESS_HTTP_HEADER_LENGTH + static_outbuf, FLAG_TCP );
486 else { 486 else {
487 torrent = add_peer_to_torrent( hash, &peer WANT_SYNC_PARAM( 0 ) ); 487 torrent = add_peer_to_torrent( hash, &peer WANT_SYNC_PARAM( 0 ) );
@@ -498,7 +498,7 @@ ssize_t http_handle_request( const int64 client_socket, char *data, size_t recv_
498#ifdef _DEBUG_HTTPERROR 498#ifdef _DEBUG_HTTPERROR
499 if( recv_length >= sizeof( debug_request ) ) 499 if( recv_length >= sizeof( debug_request ) )
500 recv_length = sizeof( debug_request) - 1; 500 recv_length = sizeof( debug_request) - 1;
501 memcpy( debug_request, recv_header, recv_length ); 501 memmove( debug_request, recv_header, recv_length );
502 debug_request[ recv_length ] = 0; 502 debug_request[ recv_length ] = 0;
503#endif 503#endif
504 504