Changeset 5690
- Timestamp:
- Apr 25, 2008, 4:26:04 AM (14 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/tracker.c
r5689 r5690 998 998 struct tr_tracker_stat * setme) 999 999 { 1000 assert( t != NULL);1001 assert( setme != NULL);1000 assert( t ); 1001 assert( setme ); 1002 1002 1003 1003 snprintf( setme->scrapeResponse, 1004 1004 sizeof( setme->scrapeResponse ), 1005 "%ld", t->lastScrapeResponse ); 1005 "%s (%ld)", tr_webGetResponseStr( t->lastScrapeResponse ), t->lastScrapeResponse ); 1006 1006 1007 setme->lastScrapeTime = t->lastScrapeTime; 1007 1008 setme->nextScrapeTime = t->scrapeAt; … … 1009 1010 snprintf( setme->announceResponse, 1010 1011 sizeof( setme->announceResponse ), 1011 "% ld", t->lastAnnounceResponse );1012 "%s (%ld)", tr_webGetResponseStr( t->lastAnnounceResponse ), t->lastAnnounceResponse ); 1012 1013 1013 1014 setme->lastAnnounceTime = t->lastAnnounceTime; -
trunk/libtransmission/web.c
r5689 r5690 10 10 */ 11 11 12 #include <stdlib.h> /* bsearch */ 13 12 14 #include <event.h> 13 15 #include <curl/curl.h> … … 99 101 curl_easy_setopt( ch, CURLOPT_USERAGENT, TR_NAME "/" LONG_VERSION_STRING ); 100 102 curl_easy_setopt( ch, CURLOPT_SSL_VERIFYPEER, 0 ); 103 curl_easy_setopt( ch, CURLOPT_TIMEOUT, 30 ); 101 104 102 105 curl_multi_add_handle( web->cm, ch ); … … 129 132 if( msg->data.result != CURLE_OK ) 130 133 tr_err( "%s", curl_easy_strerror( msg->data.result ) ); 131 134 132 135 ch = msg->easy_handle; 133 136 curl_easy_getinfo( ch, CURLINFO_PRIVATE, &task ); … … 292 295 return web; 293 296 } 297 298 /*** 299 **** 300 ***/ 301 302 static struct http_msg { 303 long code; 304 const char * text; 305 } http_msg[] = { 306 { 101, "Switching Protocols" }, 307 { 200, "OK" }, 308 { 201, "Created" }, 309 { 202, "Accepted" }, 310 { 203, "Non-Authoritative Information" }, 311 { 204, "No Content" }, 312 { 205, "Reset Content" }, 313 { 206, "Partial Content" }, 314 { 300, "Multiple Choices" }, 315 { 301, "Moved Permanently" }, 316 { 302, "Found" }, 317 { 303, "See Other" }, 318 { 304, "Not Modified" }, 319 { 305, "Use Proxy" }, 320 { 306, "(Unused)" }, 321 { 307, "Temporary Redirect" }, 322 { 400, "Bad Request" }, 323 { 401, "Unauthorized" }, 324 { 402, "Payment Required" }, 325 { 403, "Forbidden" }, 326 { 404, "Not Found" }, 327 { 405, "Method Not Allowed" }, 328 { 406, "Not Acceptable" }, 329 { 407, "Proxy Authentication Required" }, 330 { 408, "Request Timeout" }, 331 { 409, "Conflict" }, 332 { 410, "Gone" }, 333 { 411, "Length Required" }, 334 { 412, "Precondition Failed" }, 335 { 413, "Request Entity Too Large" }, 336 { 414, "Request-URI Too Long" }, 337 { 415, "Unsupported Media Type" }, 338 { 416, "Requested Range Not Satisfiable" }, 339 { 417, "Expectation Failed" }, 340 { 500, "Internal Server Error" }, 341 { 501, "Not Implemented" }, 342 { 502, "Bad Gateway" }, 343 { 503, "Service Unavailable" }, 344 { 504, "Gateway Timeout" }, 345 { 505, "HTTP Version Not Supported" }, 346 { 0, NULL } 347 }; 348 349 static int 350 compareResponseCodes( const void * va, const void * vb ) 351 { 352 const long a = *(const long*) va; 353 const struct http_msg * b = vb; 354 return a - b->code; 355 } 356 357 const char * 358 tr_webGetResponseStr( long code ) 359 { 360 struct http_msg * msg = bsearch( &code, 361 http_msg, 362 sizeof( http_msg ) / sizeof( http_msg[0] ), 363 sizeof( http_msg[0] ), 364 compareResponseCodes ); 365 return msg ? msg->text : "Unknown Error"; 366 } -
trunk/libtransmission/web.h
r5673 r5690 24 24 size_t response_byte_count, 25 25 void * user_data ); 26 27 const char * tr_webGetResponseStr( long response_code ); 26 28 27 29 void tr_webRun( tr_handle * session,
Note: See TracChangeset
for help on using the changeset viewer.