2009-04-17
2009-04-17 07:53:37 by Stephen R. van den Berg <srb@cuci.nl>
-
cda032d920e5a639e3d76cff89b167626fb2212a
(10 lines)
(+7/-3)
[
Show
| Annotate
]
Branch: 5.2
HTTP Compression fixes: Fix bug where a stale Content-Type value could be used to decide whether to use compression or not. Also added a trivial optimization (only use the compressed data if it is smaller than the original data.) Thanks to srb@cuci.nl for the patch.
Rev: server/protocols/http.pike:1.595
2:
// Modified by Francesco Chemolli to add throttling capabilities.
// Copyright © 1996 - 2004, Roxen IS.
- constant cvs_version = "$Id: http.pike,v 1.594 2009/04/01 14:05:09 grubba Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.595 2009/04/17 07:53:37 marty Exp $";
// #define REQUEST_DEBUG
#define MAGIC_ERROR
2127: Inside #if defined(HTTP_COMPRESSION)
compress_main_mimetypes[main_type])) &&
len >= min_data_length &&
(!max_data_length || len <= max_data_length)) {
- return gzip_data(data);
+ data = gzip_data(data);
+ if(len>sizeof(data))
+ return data;
}
return 0;
}
2363: Inside #if defined(RAM_CACHE) and #if defined(HTTP_COMPRESSION)
string compressed;
string encoding;
if(!file->encoding) {
- if(compressed = try_gzip_data(data, file->type)) {
+ if(compressed =
+ try_gzip_data(data, variant_heads["Content-Type"])) {
data = compressed;
file->encoding = encoding = "gzip";
}