Permalink
Browse files

Updated to use an optimized version of TEApi, cleaned up how trackers…

… are parsed and other general cleanups.
  • Loading branch information...
1 parent e4593f2 commit 81a00549ccf6a90672a837495a9aa4e1e8945342 @torrage committed Nov 2, 2010
Showing with 622 additions and 511 deletions.
  1. +10 −1 autoupload.php
  2. +84 −84 docs/README-lighttpd.txt
  3. +421 −364 inc/TEapi.inc.php
  4. +1 −0 inc/blacklist.inc.php
  5. +49 −46 inc/clean.inc.php
  6. +44 −14 inc/settings.inc.php
  7. +1 −0 inc/whitelist.inc.php
  8. +12 −2 upload.php
View
@@ -1,7 +1,8 @@
<?php
include_once dirname( __FILE__ ) . '/inc/main.inc.php';
- set_time_limit( 600 );
+ // to allow for big files
+ set_time_limit( 0 );
ini_set( 'upload_max_filesize', 6 * 1048576 );
error_reporting( 0 );
@@ -31,8 +32,16 @@ function upload_error_handler( $error )
case TORRAGE_FILE_ERROR:
header( 'X-Torrage-Error-Msg: Something didn\'t work, please try again later!' );
die( "Error $error: Something didn't work, please try again later!\n" );
+ default:
+ header( 'X-Torrage-Error-Msg: UNKNOWN ERROR' );
+ die( "Error $error: Unknown error occurred\n" );
}
}
+ elseif( empty( $error ) )
+ {
+ header( 'X-Torrage-Error-Msg: Empty hash.' );
+ die( "Error: No info hash returned.\n" );
+ }
header( "X-Torrage-Infohash: $error" );
echo "$error\n";
@@ -1,85 +1,85 @@
-# Special config for using the torrage system with lighttpd
-# You will of course also need to add your php handler.
-
-#
-#
-#
-#
-#
-# Lighttpd 1.5
-#
-#
-#
-#
-#
-
-server.modules = (
- "mod_rewrite",
- "mod_setenv",
-)
-
-server.error-handler-404 = "/404.php"
-
-url.rewrite-once = (
- "/torrent/([0-9A-F]{2,2})([0-9A-F]{2,2})([0-9A-F]{36,36}).*" => "/t/$1/$2/$3.torrent",
-)
-
-$HTTP["url"] =~ "\.torrent" {
- setenv.add-response-header = ( "Content-Encoding" => "gzip" )
- mimetype.assign = ( ".torrent" => "application/x-bittorrent" )
-}
-$HTTP["url"] =~ "\.ghtml" {
- setenv.add-response-header = ( "Content-Encoding" => "gzip" )
-}
-
-#
-#
-#
-#
-#
-# Lighttpd 2.0
-#
-#
-#
-#
-#
-
-module_load (
- "mod_status",
- "mod_fastcgi",
- "mod_dirlist",
- "mod_rewrite",
- "mod_redirect",
- "mod_expire",
- "mod_deflate",
- "mod_cache_disk_etag",
-);
-
-do_deflate {
- if req.is_handled {
- if response.header["Content-Type"] =~ "^(.*/javascript|text/.*)(;|$)" {
- deflate;
- }
- }
-}
-
-php {
- fastcgi "unix:/var/run/lighttpd/php-fastcgi.socket";
- do_deflate;
-}
-
-pregzipped {
- header.add "Content-Encoding" => "gzip";
- header.add "Vary" => "Accept-Encoding";
-}
-
-if req.host =~ "^(.+\.)?torrage.com" {
- rewrite "/torrent/([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{36}).*" => "/t/$1/$2/$3.torrent";
- docroot "/var/data/torrage.com/www";
- index ( "index.php" );
- if req.path == "/sync/" { dirlist; do_deflate; }
- if !physical.exists { rewrite "/404.php"; docroot "/var/data/torrage.com/www"; php; set_status 404; }
- else if req.path =$ ".torrent" { pregzipped; }
- else if req.path =$ ".php" { php; }
- if req.path =$ ".ghtml" { pregzipped; }
+# Special config for using the torrage system with lighttpd
+# You will of course also need to add your php handler.
+
+#
+#
+#
+#
+#
+# Lighttpd 1.5
+#
+#
+#
+#
+#
+
+server.modules = (
+ "mod_rewrite",
+ "mod_setenv",
+)
+
+server.error-handler-404 = "/404.php"
+
+url.rewrite-once = (
+ "/torrent/([0-9A-F]{2,2})([0-9A-F]{2,2})([0-9A-F]{36,36}).*" => "/t/$1/$2/$3.torrent",
+)
+
+$HTTP["url"] =~ "\.torrent" {
+ setenv.add-response-header = ( "Content-Encoding" => "gzip" )
+ mimetype.assign = ( ".torrent" => "application/x-bittorrent" )
+}
+$HTTP["url"] =~ "\.ghtml" {
+ setenv.add-response-header = ( "Content-Encoding" => "gzip" )
+}
+
+#
+#
+#
+#
+#
+# Lighttpd 2.0
+#
+#
+#
+#
+#
+
+module_load (
+ "mod_status",
+ "mod_fastcgi",
+ "mod_dirlist",
+ "mod_rewrite",
+ "mod_redirect",
+ "mod_expire",
+ "mod_deflate",
+ "mod_cache_disk_etag",
+);
+
+do_deflate {
+ if req.is_handled {
+ if response.header["Content-Type"] =~ "^(.*/javascript|text/.*)(;|$)" {
+ deflate;
+ }
+ }
+}
+
+php {
+ fastcgi "unix:/var/run/lighttpd/php-fastcgi.socket";
+ do_deflate;
+}
+
+pregzipped {
+ header.add "Content-Encoding" => "gzip";
+ header.add "Vary" => "Accept-Encoding";
+}
+
+if req.host =~ "^(.+\.)?torrage.com" {
+ rewrite "/torrent/([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{36}).*" => "/t/$1/$2/$3.torrent";
+ docroot "/var/data/torrage.com/www";
+ index ( "index.php" );
+ if req.path == "/sync/" { dirlist; do_deflate; }
+ if !physical.exists { rewrite "/404.php"; docroot "/var/data/torrage.com/www"; php; set_status 404; }
+ else if req.path =$ ".torrent" { pregzipped; }
+ else if req.path =$ ".php" { php; }
+ if req.path =$ ".ghtml" { pregzipped; }
}
Oops, something went wrong.

0 comments on commit 81a0054

Please sign in to comment.