httpd: simplified "gzip" test

function                                             old     new   delta
handle_incoming_and_exit                            2830    2807     -23

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Peter Korsgaard 2010-07-26 02:08:35 +02:00 committed by Denys Vlasenko
parent ba2dcccd79
commit e5dbd56d77

View File

@ -2081,18 +2081,18 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
#endif #endif
#if ENABLE_FEATURE_HTTPD_GZIP #if ENABLE_FEATURE_HTTPD_GZIP
if (STRNCASECMP(iobuf, "Accept-Encoding:") == 0) { if (STRNCASECMP(iobuf, "Accept-Encoding:") == 0) {
char *s = iobuf + sizeof("Accept-Encoding:")-1; /* Note: we do not support "gzip;q=0"
while (*s) { * method of _disabling_ gzip
///is "Accept-Encoding: compress,gzip" valid? * delivery. No one uses that, though */
// (that is, no space after ',') - const char *s = strstr(iobuf, "gzip");
// this code won't handle that if (s) {
s = skip_whitespace(s); // want more thorough checks?
if (STRNCASECMP(s, "gzip") == 0) //if (s[-1] == ' '
// || s[-1] == ','
// || s[-1] == ':'
//) {
content_gzip = 1; content_gzip = 1;
/* Note: we do not support "gzip;q=0" //}
* method of _disabling_ gzip
* delivery */
s = skip_non_whitespace(s);
} }
} }
#endif #endif