You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1996/04/07 22:14:44 UTC
[Near] Fix for multiple content encodings bug (fwd)
not acked..
MIME-Version: 1.0 (NeXT Mail 3.3risc v118.3)
Content-Type: multipart/alternative; boundary=NeXT-Mail-1515183957-1
Content-Transfer-Encoding: 7bit
X-Nextstep-Mailer: Mail 3.3 (Enhance X)
From: Bill Bumgarner <bb...@friday.com>
Date: Sun, 7 Apr 96 14:29:40 -0500
To: apache-bugs@mail.apache.org
Subject: [Near] Fix for multiple content encodings bug
cc: jeff@netsurfer.com, tom@pdh.com
Reply-To: bbum@friday.com
X-A: Budded on earth....
X-B: ...to bloom in heaven.
--NeXT-Mail-1515183957-1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Enclosed is a slightly modified version of find_ct()-- assuming you have a =
mime-capable mail reader, the lines that are changed should be bold [if =
not, the changes are minor and should be easy to figure out].
With the URL and configuration from the original bug report =
[http://www.friday.com/~bbum/Urlifier-1_7.bundle.tar.gz], apache now =
yields the headers:
HTTP/1.0 200 OK
Date: Sun, 07 Apr 1996 ? GMT
Server: Apache/1.0.3
Content-type: application/bundle-MAB
Content-encoding: x-gzip
Content-encoding: x-tar
Content-length: 17428
Last-modified: Sun, 07 Apr 1996 ? GMT
Unfortunately, this [likely] cannot be counted as a *complete* fix-- if =
the targeted URL contains THREE or more encodings -- IE; =
http://www.friday.com/~bbum/Urlifier-1_7.bundle.tar.gz.Z -- the resultant =
header will have the last content-encoding by itself, but all the rest =
will appear as a comma seperated list. IE;
HTTP/1.0 200 OK
Date: Sun, 07 Apr 1996 ? GMT
Server: Apache/1.0.3
Content-type: application/bundle-MAB
Content-encoding: x-compress
Content-encoding: x-gzip, x-tar
Content-length: 17428
Last-modified: Sun, 07 Apr 1996 ? GMT
Unless the Content-encoding: field CAN contain a comma seperated list of =
encodings [notice that the order is preserved, left to right, top to =
bottom...], the enclosed patch is not totally correct. Unfortunately, to =
break the list out into individual headers would require a much more =
significant patch.
[Jeff: I noticed that the NetKit DOES correctly handle multiple encoding =
headers with some being comma separated lists. Most Excellent! I will =
have a quad-fat compile of Apache to you in short order.]
thanks,
b.bum
int find_ct(request_rec *r)
{
int i;
char *fn =3D pstrdup (r->pool, r->filename);
mime_dir_config *conf =3D
(mime_dir_config *)get_module_config(r->per_dir_config, &mime_module);
char *type;
if (S_ISDIR(r->finfo.st_mode)) {
r->content_type =3D DIR_MAGIC_TYPE;
return OK;
}
if((i=3Drind(fn,'.')) < 0) return DECLINED;
++i;
while ((type =3D table_get (conf->encoding_types, &fn[i])))
{
if (r->content_encoding =3D=3D NULL) {
r->content_encoding =3D type;
} else {
table_merge(r->headers_out, "Content-encoding", type);
}
/* go back to previous extension to try to use it as a =
language */
fn[i-1] =3D '\0';
if((i=3Drind(fn,'.')) < 0) return OK;
++i;
}
if ((type =3D table_get (conf->language_types, &fn[i])))
{
r->content_language =3D type;
/* go back to previous extension to try to use it as a type */
fn[i-1] =3D '\0';
if((i=3Drind(fn,'.')) < 0) return OK;
++i;
}
if ((type =3D table_get (conf->forced_types, &fn[i]))
|| (type =3D table_get (hash_buckets[hash(fn[i])], &fn[i])))
{
r->content_type =3D type;
}
return OK;
}
--NeXT-Mail-1515183957-1
Content-Type: text/enriched; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Enclosed is a slightly modified version of find_ct()-- assuming you have a =
mime-capable mail reader, the lines that are changed should be=20
<bold>bold
</bold> [if not, the changes are minor and should be easy to figure out].
With the URL and configuration from the original bug report =
[http://www.friday.com/~bbum/Urlifier-1_7.bundle.tar.gz], apache now =
yields the headers:
HTTP/1.0 200 OK
Date: Sun, 07 Apr 1996 ? GMT
Server: Apache/1.0.3
Content-type: application/bundle-MAB
Content-encoding: x-gzip
Content-encoding: x-tar
Content-length: 17428
Last-modified: Sun, 07 Apr 1996 ? GMT
Unfortunately, this [likely] cannot be counted as a *complete* fix-- if =
the targeted URL contains THREE or more encodings -- IE; =
http://www.friday.com/~bbum/Urlifier-1_7.bundle.tar.gz.Z -- the resultant =
header will have the last content-encoding by itself, but all the rest =
will appear as a comma seperated list. IE;
HTTP/1.0 200 OK
Date: Sun, 07 Apr 1996 ? GMT
Server: Apache/1.0.3
Content-type: application/bundle-MAB
Content-encoding: x-compress
Content-encoding: x-gzip, x-tar
Content-length: 17428
Last-modified: Sun, 07 Apr 1996 ? GMT
Unless the Content-encoding: field CAN contain a comma seperated list of =
encodings [notice that the order is preserved, left to right, top to =
bottom...], the enclosed patch is not totally correct. Unfortunately, to =
break the list out into individual headers would require a much more =
significant patch.
[Jeff: I noticed that the NetKit DOES correctly handle multiple encoding =
headers with some being comma separated lists. Most Excellent! I will =
have a quad-fat compile of Apache to you in short order.]
thanks,
b.bum
int find_ct(request_rec *r)
int i;
char *fn =3D pstrdup (r->pool, r->filename);
mime_dir_config *conf =3D
(mime_dir_config *)get_module_config(r->per_dir_config, &mime_module);
char *type;
if (S_ISDIR(r->finfo.st_mode))=20
r->content_type =3D DIR_MAGIC_TYPE;
return OK;
=20
if((i=3Drind(fn,'.')) << 0) return DECLINED;
++i;
while ((type =3D table_get (conf->encoding_types, &fn[i])))
=20
<bold> if (r->content_encoding =3D=3D NULL)=20
r->content_encoding =3D type;
else=20
table_merge(r->headers_out, "Content-encoding", type);
=20
</bold> /* go back to previous extension to try to use it as a =
language */
fn[i-1] =3D '';
if((i=3Drind(fn,'.')) << 0) return OK;
++i;
=20
if ((type =3D table_get (conf->language_types, &fn[i])))
=20
r->content_language =3D type;
/* go back to previous extension to try to use it as a type */
fn[i-1] =3D '';
if((i=3Drind(fn,'.')) << 0) return OK;
++i;
=20
if ((type =3D table_get (conf->forced_types, &fn[i]))
|| (type =3D table_get (hash_buckets[hash(fn[i])], &fn[i])))
=20
r->content_type =3D type;
=20
return OK;
--NeXT-Mail-1515183957-1--
----- End of forwarded message from Bill Bumgarner -----
--
Rob Hartill (robh@imdb.com)
The Internet Movie Database (IMDb) http://www.imdb.com/
...more movie info than you can poke a stick at.