* use gzip compression for all sourceforge project-web responses

This commit is contained in:
Reinhard Pointner 2013-10-17 07:39:12 +00:00
parent 5b839d1ca8
commit 0db73ef38f
2 changed files with 17 additions and 3 deletions

View File

@ -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);

View File

@ -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&currency_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