Make us handle type:application/x-gunzip, encoding:gzip. Bug 128177,

r=bbaetz, sr=darin, a=shaver
This commit is contained in:
bzbarsky%mit.edu 2002-02-28 23:54:58 +00:00
Родитель 48b7bc0ad5
Коммит 1521a3a702
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -60,6 +60,7 @@
#define APPLICATION_FORTEZZA_KRL "application/x-fortezza-krl" #define APPLICATION_FORTEZZA_KRL "application/x-fortezza-krl"
#define APPLICATION_GZIP "application/x-gzip" #define APPLICATION_GZIP "application/x-gzip"
#define APPLICATION_GZIP2 "application/gzip" #define APPLICATION_GZIP2 "application/gzip"
#define APPLICATION_GZIP3 "application/x-gunzip"
#define APPLICATION_HTTP_INDEX_FORMAT "application/http-index-format" #define APPLICATION_HTTP_INDEX_FORMAT "application/http-index-format"
#define APPLICATION_JAVASCRIPT "application/x-javascript" #define APPLICATION_JAVASCRIPT "application/x-javascript"
#define APPLICATION_NETSCAPE_REVOCATION "application/x-netscape-revocation" #define APPLICATION_NETSCAPE_REVOCATION "application/x-netscape-revocation"

Просмотреть файл

@ -566,13 +566,22 @@ nsHttpChannel::ProcessNormal()
// as well as Content-Encoding: gzip, which is completely wrong. In // as well as Content-Encoding: gzip, which is completely wrong. In
// this case, we choose to ignore the rogue Content-Encoding header. We // this case, we choose to ignore the rogue Content-Encoding header. We
// must do this early on so as to prevent it from being seen up stream. // must do this early on so as to prevent it from being seen up stream.
// The same problem exists for Content-Encoding: compress in default
// Apache installs.
const char *encoding = mResponseHead->PeekHeader(nsHttp::Content_Encoding); const char *encoding = mResponseHead->PeekHeader(nsHttp::Content_Encoding);
if (encoding && PL_strcasestr(encoding, "gzip") && ( if (encoding && PL_strcasestr(encoding, "gzip") && (
!PL_strcmp(mResponseHead->ContentType(), APPLICATION_GZIP) || !PL_strcmp(mResponseHead->ContentType(), APPLICATION_GZIP) ||
!PL_strcmp(mResponseHead->ContentType(), APPLICATION_GZIP2))) { !PL_strcmp(mResponseHead->ContentType(), APPLICATION_GZIP2) ||
!PL_strcmp(mResponseHead->ContentType(), APPLICATION_GZIP3))) {
// clear the Content-Encoding header // clear the Content-Encoding header
mResponseHead->SetHeader(nsHttp::Content_Encoding, nsnull); mResponseHead->SetHeader(nsHttp::Content_Encoding, nsnull);
} }
else if (encoding && PL_strcasestr(encoding, "compress") && (
!PL_strcmp(mResponseHead->ContentType(), APPLICATION_COMPRESS) ||
!PL_strcmp(mResponseHead->ContentType(), APPLICATION_COMPRESS2))) {
// clear the Content-Encoding header
mResponseHead->SetHeader(nsHttp::Content_Encoding, nsnull);
}
// this must be called before firing OnStartRequest, since http clients, // this must be called before firing OnStartRequest, since http clients,
// such as imagelib, expect our cache entry to already have the correct // such as imagelib, expect our cache entry to already have the correct