Changeset 6861
- Timestamp:
- Oct 7, 2008, 1:25:29 AM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/platform.c
r6795 r6861 611 611 } 612 612 613 if( !*path )614 {615 tr_strlcpy( path, "/dev/null", sizeof( path ) );616 tr_err( _(617 "Couldn't find the web interface's files! To customize this, set the CLUTCH_HOME environmental variable to the folder where index.html is located." ) );618 }619 620 613 s = tr_strdup( path ); 621 614 } -
trunk/libtransmission/rpc-server.c
r6856 r6861 71 71 evbuffer_add_printf( body, "<h1>%d: %s</h1>", code, code_text ); 72 72 if( text ) 73 evbuffer_add_printf( body, " <h2>%s</h2>", text );73 evbuffer_add_printf( body, "%s", text ); 74 74 evhttp_send_reply( req, code, code_text, body ); 75 75 evbuffer_free( body ); … … 321 321 struct tr_rpc_server * server ) 322 322 { 323 char * pch;324 char * subpath;325 char * filename;326 323 const char * clutchDir = tr_getClutchDir( server->session ); 327 324 328 325 assert( !strncmp( req->uri, "/transmission/web/", 18 ) ); 329 326 330 subpath = tr_strdup( req->uri + 18 ); 331 if(( pch = strchr( subpath, '?' ))) 332 *pch = '\0'; 333 334 filename = *subpath 335 ? tr_strdup_printf( "%s%s%s", clutchDir, TR_PATH_DELIMITER_STR, subpath ) 336 : tr_strdup_printf( "%s%s%s", clutchDir, TR_PATH_DELIMITER_STR, "index.html" ); 337 338 serve_file( req, filename ); 339 340 tr_free( filename ); 341 tr_free( subpath ); 327 if( !clutchDir || !*clutchDir ) 328 { 329 send_simple_response( req, HTTP_NOTFOUND, 330 "<p>Couldn't find Transmission's web interface files!</p>" 331 "<p>Users: to tell Transmission where to look, " 332 "set the TRANSMISSION_WEB_HOME environmental " 333 "variable to the folder where the web interface's " 334 "index.html is located.</p>" 335 "<p>Package Builders: to set a custom default at compile time, " 336 "#define PACKAGE_DATA_DIR in libtransmission/platform.c " 337 "or tweak tr_getClutchDir() by hand.</p>" ); 338 } 339 else 340 { 341 char * pch; 342 char * subpath; 343 char * filename; 344 345 subpath = tr_strdup( req->uri + 18 ); 346 if(( pch = strchr( subpath, '?' ))) 347 *pch = '\0'; 348 349 filename = *subpath 350 ? tr_strdup_printf( "%s%s%s", clutchDir, TR_PATH_DELIMITER_STR, subpath ) 351 : tr_strdup_printf( "%s%s%s", clutchDir, TR_PATH_DELIMITER_STR, "index.html" ); 352 353 serve_file( req, filename ); 354 355 tr_free( filename ); 356 tr_free( subpath ); 357 } 342 358 } 343 359
Note: See TracChangeset
for help on using the changeset viewer.