2010-10-18
2010-10-18 07:42:38 by Martin Jonsson <marty@roxen.com>
-
b243515b7dcdda7f1cd62c6443080c867cb0c19a
(17 lines)
(+14/-3)
[
Show
| Annotate
]
Branch: 5.2
Handle multiple Accept-Encoding request headers in client_gzip_enabled(). [Bug 5750 (#5750)], [RT #16147].
Rev: server/protocols/http.pike:1.628
2:
// Modified by Francesco Chemolli to add throttling capabilities.
// Copyright © 1996 - 2009, Roxen IS.
- constant cvs_version = "$Id: http.pike,v 1.627 2010/10/11 09:50:35 stewa Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.628 2010/10/18 07:42:38 marty Exp $";
// #define REQUEST_DEBUG
#define MAGIC_ERROR
2493: Inside #if defined(HTTP_COMPRESSION)
private int(0..1) client_gzip_enabled()
{
- if (string ae = request_headers["accept-encoding"])
- return has_value("," + lower_case(ae - " " - "\t") + ",", ",gzip,");
+ array(string)|string accept_encoding = request_headers["accept-encoding"];
+
+ if (stringp (accept_encoding)) {
+ return has_value("," + lower_case(accept_encoding - " " - "\t") + ",",
+ ",gzip,");
+ } else if (arrayp (accept_encoding)) {
+ foreach (accept_encoding, string ae) {
+ if (has_value("," + lower_case(ae - " " - "\t") + ",", ",gzip,"))
+ return 1;
+ }
+ }
+
return 0;
}