dgaudet 97/10/30 11:20:52
Modified:src CHANGES
src/modules/standard mod_mime_magic.c
Log:
Bug Fixes:
- gzip -cdq requires at least 4k of a partial gzipped file, we
were sending it only 1k, and it wouldn't produce any output. But raising
HOWMANY to 4k has implications on the performance of the (lame) ascmagic()
code. So ascmagic() cheats and only looks at 1k (the previous HOWMANY
setting)
- use spawn_child() interface to avoid a resource leak (zombie
child); I don't think even worked on WIN32 before, but it might now... I
special case and use spawnvp() on WIN32.
- use pfopen()/popenf() to avoid resource leaks
Cleanups:
- no need to test return from palloc since it never returns NULL
- ensure all log messages include the module name
- Some cases were assuming that aplog_error was a never returning
function. Deal gracefully by propagating an error code back
up the call chain.
- remove some useless code in fsmagic() -- we don't use lstat(), we
use stat() so the only possibility where we'll get S_IFLNK is
if it's a broken symlink.
- for various errors just DECLINE rather than cause the phase to abort
early (a lesson we're learning from all the M_PUT changes we've
had recently)
PR: 1205
Reviewed by: Jim Jagielski, Martin Kraemer
Revision ChangesPath
1.482 +5 -0 apachen/src/CHANGES
Index: CHANGES
===
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.481
retrieving revision 1.482
diff -u -r1.481 -r1.482
--- CHANGES 1997/10/30 19:17:54 1.481
+++ CHANGES 1997/10/30 19:20:48 1.482
@@ -1,5 +1,10 @@
Changes with Apache 1.3b3
+ *) Various mod_mime_magic bug fixes and cleanups: Uncompression
+ should work, it should work on WIN32, and a few resource
+ leaks and abort conditions are fixed.
+ [Dean Gaudet] PR#1205
+
*) PORT: On AIX 1.x files can't be named '@', fix the proxy cache
to use '%' instead of '@' in its encodings.
[David Schuler [EMAIL PROTECTED]] PR#1317
1.19 +179 -206 apachen/src/modules/standard/mod_mime_magic.c
Index: mod_mime_magic.c
===
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_mime_magic.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- mod_mime_magic.c 1997/10/26 21:41:11 1.18
+++ mod_mime_magic.c 1997/10/30 19:20:51 1.19
@@ -144,7 +144,10 @@
#define MAXMIMESTRING256
-#define HOWMANY 1024 /* big enough to recognize most WWW files */
+/* HOWMANY must be at least 4096 to make gzip -dcq work */
+#define HOWMANY 4096
+/* SMALL_HOWMANY limits how much work we do to figure out text files */
+#define SMALL_HOWMANY 1024
#define MAXDESC50/* max leng of text description */
#define MAXstring 64 /* max leng of string types */
@@ -504,8 +507,8 @@
{
magic_server_config_rec *base = (magic_server_config_rec *) basev;
magic_server_config_rec *add = (magic_server_config_rec *) addv;
-magic_server_config_rec *new
-= (magic_server_config_rec *) palloc(p, sizeof(magic_server_config_rec));
+magic_server_config_rec *new = (magic_server_config_rec *)
+ palloc(p, sizeof(magic_server_config_rec));
new-magicfile = add-magicfile ? add-magicfile : base-magicfile;
if (add-magic add-last) {
@@ -565,12 +568,6 @@
magic_req_rec *req_dat = (magic_req_rec *) palloc(r-pool,
sizeof(magic_req_rec));
-if (!req_dat) {
- aplog_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r-server,
- %s: memory allocation failure in magic_set_config(),
- MODNAME);
- return NULL;
-}
req_dat-head = req_dat-tail = (magic_rsl *) NULL;
set_module_config(r-request_config, mime_magic_module, req_dat);
return req_dat;
@@ -587,8 +584,7 @@
/* make sure we have a list to put it in */
if (!req_dat) {
aplog_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r-server,
- %s: request config should not be NULL,
- MODNAME);
+ MODNAME : request config should not be NULL);
if (!(req_dat = magic_set_config(r))) {
/* failure */
return -1;
@@ -596,13 +592,7 @@
}
/* allocate the list entry */
-if (!(rsl = (magic_rsl *) palloc(r-pool, sizeof(magic_rsl {
- aplog_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r-server,
- %s: memory allocation failure in magic_rsl_add(),
- MODNAME);
- /* failure */
- return -1;
-