[PATCH] httpd: make Accept-Encoding parsing more robust
Peter Korsgaard
jacmet at sunsite.dk
Sun Jul 25 08:58:05 UTC 2010
From: Peter Korsgaard <peter.korsgaard at barco.com>
Handle missing spaces between options and detect the legacy x-gzip
encoding as well.
bloat-o-meter:
function old new delta
handle_incoming_and_exit 3121 3080 -41
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes
Signed-off-by: Peter Korsgaard <peter.korsgaard at barco.com>
---
networking/httpd.c | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/networking/httpd.c b/networking/httpd.c
index cad45cd..ffdff53 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2081,19 +2081,8 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
#endif
#if ENABLE_FEATURE_HTTPD_GZIP
if (STRNCASECMP(iobuf, "Accept-Encoding:") == 0) {
- char *s = iobuf + sizeof("Accept-Encoding:")-1;
- while (*s) {
- ///is "Accept-Encoding: compress,gzip" valid?
- // (that is, no space after ',') -
- // this code won't handle that
- s = skip_whitespace(s);
- if (STRNCASECMP(s, "gzip") == 0)
- content_gzip = 1;
- /* Note: we do not support "gzip;q=0"
- * method of _disabling_ gzip
- * delivery */
- s = skip_non_whitespace(s);
- }
+ if (strcasestr(iobuf, "gzip"))
+ content_gzip = 1;
}
#endif
} /* while extra header reading */
--
1.7.1
More information about the busybox
mailing list