From 0db73ef38f0fbc05f4fc6b6657ab6d29e14a1928 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 17 Oct 2013 07:39:12 +0000 Subject: [PATCH] * use gzip compression for all sourceforge project-web responses --- source/net/sourceforge/filebot/web/WebRequest.java | 6 ++++-- website/.htaccess | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source/net/sourceforge/filebot/web/WebRequest.java b/source/net/sourceforge/filebot/web/WebRequest.java index 52ba31c0..d324ba61 100644 --- a/source/net/sourceforge/filebot/web/WebRequest.java +++ b/source/net/sourceforge/filebot/web/WebRequest.java @@ -124,7 +124,7 @@ public final class WebRequest { } try { - connection.addRequestProperty("Accept-Encoding", "gzip"); + connection.addRequestProperty("Accept-Encoding", "gzip,deflate"); connection.addRequestProperty("Accept-Charset", "UTF-8"); } catch (IllegalStateException e) { // too bad, can't request gzipped data @@ -140,8 +140,10 @@ public final class WebRequest { String encoding = connection.getContentEncoding(); InputStream in = connection.getInputStream(); - if ("gzip".equalsIgnoreCase(encoding)) { + if ("gzip".equalsIgnoreCase(encoding)) in = new GZIPInputStream(in); + else if ("deflate".equalsIgnoreCase(encoding)) { + in = new InflaterInputStream(in, new Inflater(true)); } ByteBufferOutputStream buffer = new ByteBufferOutputStream(contentLength >= 0 ? contentLength : 4 * 1024); diff --git a/website/.htaccess b/website/.htaccess index f91231db..f0fca837 100644 --- a/website/.htaccess +++ b/website/.htaccess @@ -1,6 +1,18 @@ +# redirect donate.html to paypal redirect 301 /donate.html https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=Z8JHALZ4TXGWL&lc=US&item_name=FileBot%20Media%20Renamer¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted - +# redirect filebot.sourceforge.net to www.filebot.net RewriteEngine On RewriteCond %{HTTP_HOST} =filebot.sourceforge.net [NC] RewriteRule ^(.*)$ http://www.filebot.net/$1 [R=301,L] + +# compress text, html, javascript, css, xml +AddOutputFilterByType DEFLATE text/plain +AddOutputFilterByType DEFLATE text/html +AddOutputFilterByType DEFLATE text/xml +AddOutputFilterByType DEFLATE text/css +AddOutputFilterByType DEFLATE application/xml +AddOutputFilterByType DEFLATE application/xhtml+xml +AddOutputFilterByType DEFLATE application/rss+xml +AddOutputFilterByType DEFLATE application/javascript +AddOutputFilterByType DEFLATE application/x-javascript