2009-01-28
2009-01-28 18:28:37 by Jonas Wallden <jonasw@roxen.com>
-
c46b8e48f19e24b1fe0fadba4ec97904ea53651f
(13 lines)
(+6/-7)
[
Show
| Annotate
]
Branch: 5.2
Fix bug when returning data that didn't get compressed. Speed up test for
suitable Accept-Encoding header.
Rev: server/protocols/http.pike:1.584
2:
// Modified by Francesco Chemolli to add throttling capabilities.
// Copyright © 1996 - 2004, Roxen IS.
- constant cvs_version = "$Id: http.pike,v 1.583 2009/01/28 17:33:47 marty Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.584 2009/01/28 18:28:37 jonasw Exp $";
// #define REQUEST_DEBUG
#define MAGIC_ERROR
2059: Inside #if defined(HTTP_COMPRESSION)
private int(0..1) client_gzip_enabled()
{
- multiset(string) accept_encodings =
- (multiset)map(lower_case(request_headers["accept-encoding"] || "") / ",",
- String.trim_whites);
-
- return accept_encodings["gzip"];
+ if (string ae = request_headers["accept-encoding"])
+ return has_value("," + lower_case(ae - " " - "\t") + ",", ",gzip,");
+ return 0;
}
#endif // HTTP_COMPRESSION
2315: Inside #if defined(RAM_CACHE)
]);
#ifdef HTTP_COMPRESSION
- if(client_gzip_enabled()) {
+ if(compressed && client_gzip_enabled()) {
file->data = compressed;
file->encoding = encoding;
file->compressed = 1;