Changeset 2034
- Timestamp:
- Jun 10, 2007, 10:26:59 PM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/http.c
r1773 r2034 529 529 assert( HTTP_STATE_ERROR == http->state ); 530 530 } 531 } 532 533 void 534 tr_httpGetRequest( tr_http_t * http, const char ** buf, int * len ) 535 { 536 *buf = http->body.buf; 537 *len = http->body.used; 531 538 } 532 539 -
trunk/libtransmission/http.h
r1293 r2034 66 66 void tr_httpAddHeader( tr_http_t *, const char *, const char * ); 67 67 void tr_httpAddBody( tr_http_t *, const char *, ... ) PRINTF( 2, 3 ); 68 void tr_httpGetRequest( tr_http_t *, const char **, int * ); 68 69 tr_tristate_t tr_httpPulse( tr_http_t *, const char **, int * ); 69 70 char * tr_httpWhatsMyAddress( tr_http_t * ); -
trunk/libtransmission/platform.c
r1998 r2034 36 36 #include <pwd.h> 37 37 38 static char * tr_getHomeDirectory() 38 const char * 39 tr_getHomeDirectory( void ) 39 40 { 40 41 static char homeDirectory[MAX_PATH_LENGTH]; … … 66 67 return homeDirectory; 67 68 } 69 70 #else 71 72 const char * 73 tr_getHomeDirectory( void ) 74 { 75 /* XXX */ 76 return ""; 77 } 78 68 79 #endif /* !SYS_BEOS && !__AMIGAOS4__ */ 69 80 -
trunk/libtransmission/platform.h
r1998 r2034 45 45 tr_thread_t; 46 46 47 /* only for debugging purposes */ 48 const char * tr_getHomeDirectory( void ); 49 47 50 char * tr_getCacheDirectory(); 48 51 char * tr_getTorrentsDirectory(); -
trunk/libtransmission/upnp.c
r2032 r2034 24 24 25 25 #include "transmission.h" 26 27 /* uncomment this to log requests and responses to ~/transmission-upnp.log */ 28 /* #define VERBOSE_LOG */ 26 29 27 30 #define SSDP_ADDR "239.255.255.250" … … 155 158 char dir, int getname ); 156 159 160 #ifdef VERBOSE_LOG 161 static FILE * vlog = NULL; 162 #endif 163 157 164 tr_upnp_t * 158 165 tr_upnpInit() … … 168 175 upnp->infd = -1; 169 176 upnp->outfd = -1; 177 178 #ifdef VERBOSE_LOG 179 if( NULL == vlog ) 180 { 181 char path[MAX_PATH_LENGTH]; 182 time_t stupid_api; 183 snprintf( path, sizeof path, "%s/transmission-upnp.log", 184 tr_getHomeDirectory()); 185 vlog = fopen( path, "a" ); 186 stupid_api = time( NULL ); 187 fprintf( vlog, "opened log at %s\n\n", ctime( &stupid_api ) ); 188 } 189 #endif 170 190 171 191 return upnp; … … 258 278 259 279 free( upnp ); 280 281 #ifdef VERBOSE_LOG 282 if( NULL != vlog ) 283 { 284 fflush( vlog ); 285 } 286 #endif 287 260 288 } 261 289 … … 346 374 sin.sin_addr.s_addr = inet_addr( SSDP_ADDR ); 347 375 sin.sin_port = htons( SSDP_PORT ); 376 377 #ifdef VERBOSE_LOG 378 fprintf( vlog, "send ssdp message, %i bytes:\n", len ); 379 fwrite( buf, 1, len, vlog ); 380 fputs( "\n\n", vlog ); 381 #endif 348 382 349 383 if( 0 > sendto( fd, buf, len, 0, … … 462 496 else 463 497 { 498 #ifdef VERBOSE_LOG 499 fprintf( vlog, "receive ssdp message, %i bytes:\n", *len ); 500 fwrite( buf, 1, *len, vlog ); 501 fputs( "\n\n", vlog ); 502 #endif 464 503 return TR_NET_OK; 465 504 } … … 810 849 makeHttp( int method, const char * host, int port, const char * path ) 811 850 { 851 tr_http_t * ret; 852 #ifdef VERBOSE_LOG 853 const char * body; 854 int len; 855 #endif 856 812 857 if( tr_httpIsUrl( path, -1 ) ) 813 858 { 814 ret urntr_httpClientUrl( method, "%s", path );859 ret = tr_httpClientUrl( method, "%s", path ); 815 860 } 816 861 else 817 862 { 818 return tr_httpClient( method, host, port, "%s", path ); 819 } 863 ret = tr_httpClient( method, host, port, "%s", path ); 864 } 865 866 #ifdef VERBOSE_LOG 867 tr_httpGetRequest( ret, &body, &len ); 868 fprintf( vlog, "send http message, %i bytes:\n", len ); 869 fwrite( body, 1, len, vlog ); 870 fputs( "\n\n", vlog ); 871 #endif 872 873 return ret; 820 874 } 821 875 … … 923 977 { 924 978 case TR_NET_OK: 979 #ifdef VERBOSE_LOG 980 fprintf( vlog, "receive http message, %i bytes:\n", hlen ); 981 fwrite( headers, 1, hlen, vlog ); 982 fputs( "\n\n", vlog ); 983 #endif 925 984 code = tr_httpResponseCode( headers, hlen ); 926 985 if( SOAP_METHOD_NOT_ALLOWED == code && !dev->soapretry )
Note: See TracChangeset
for help on using the changeset viewer.