You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@locus.apache.org on 2000/02/20 02:14:49 UTC
cvs commit: apache-1.3/src/main http_protocol.c util.c
jim 00/02/19 17:14:49
Modified: . STATUS
src/include ap_mmn.h httpd.h
src/main http_protocol.c util.c
Log:
Hrm
Revision Changes Path
1.808 +3 -5 apache-1.3/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apache-1.3/STATUS,v
retrieving revision 1.807
retrieving revision 1.808
diff -u -r1.807 -r1.808
--- STATUS 2000/02/19 12:51:11 1.807
+++ STATUS 2000/02/20 01:14:45 1.808
@@ -1,5 +1,5 @@
1.3 STATUS:
- Last modified at [$Date: 2000/02/19 12:51:11 $]
+ Last modified at [$Date: 2000/02/20 01:14:45 $]
Release:
@@ -28,10 +28,8 @@
RELEASE SHOWSTOPPERS:
* general/5766: AddDefaultCharset bug with CGI scripts
- STATUS: Still not fixed. Jim has a patch that adds the
- default charset iff AddDefaultCharset is enabled AND
- the type is text/plain or text/html, but he's not sure
- if that's correct... Comments?
+ STATUS: Patch available.
+ Message-ID: <20...@devsys.jaguNET.com>
general/5760: Use of text type "t" in fopen call...
RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
1.44 +2 -1 apache-1.3/src/include/ap_mmn.h
Index: ap_mmn.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ap_mmn.h 2000/01/12 15:54:56 1.43
+++ ap_mmn.h 2000/02/20 01:14:46 1.44
@@ -226,6 +226,7 @@
* ap_base64encode_len(), ap_base64decode(),
* ap_base64decode_binary(), ap_base64decode_len(),
* ap_pbase64decode(), ap_pbase64encode()
+ * 19990320.7 - add ap_strcasestr()
*/
#define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */
@@ -233,7 +234,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 19990320
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 6 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 7 /* 0...n */
#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */
/* Useful for testing for features. */
1.305 +1 -0 apache-1.3/src/include/httpd.h
Index: httpd.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.304
retrieving revision 1.305
diff -u -r1.304 -r1.305
--- httpd.h 2000/02/02 20:43:43 1.304
+++ httpd.h 2000/02/20 01:14:46 1.305
@@ -1008,6 +1008,7 @@
API_EXPORT(int) ap_is_matchexp(const char *str);
API_EXPORT(int) ap_strcmp_match(const char *str, const char *exp);
API_EXPORT(int) ap_strcasecmp_match(const char *str, const char *exp);
+API_EXPORT(char *) ap_strcasestr(const char *s1, const char *s2);
API_EXPORT(char *) ap_pbase64decode(pool *p, const char *bufcoded);
API_EXPORT(char *) ap_pbase64encode(pool *p, char *string);
API_EXPORT(char *) ap_uudecode(pool *p, const char *bufcoded);
1.289 +17 -9 apache-1.3/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -r1.288 -r1.289
--- http_protocol.c 2000/02/08 00:34:36 1.288
+++ http_protocol.c 2000/02/20 01:14:47 1.289
@@ -112,22 +112,30 @@
* - return type
*/
static const char *make_content_type(request_rec *r, const char *type) {
- const char *i;
+ char *needcset[] = {
+ "text/plain",
+ "text/html",
+ NULL };
+ char **pcset;
core_dir_config *conf = (core_dir_config *)ap_get_module_config(
r->per_dir_config, &core_module);
if (!type) type = ap_default_type(r);
if (conf->add_default_charset != ADD_DEFAULT_CHARSET_ON) return type;
- i = type;
- while (*i && *i != ';') i++;
- if (*i && *i == ';') {
+ if (ap_strcasestr(type, "charset=") != NULL) {
/* already has parameter, do nothing */
- /* XXX should check for actual charset=, but then we need real
- * parsing code
- */
+ /* XXX we don't check the validity */
+ ;
} else {
- type = ap_pstrcat(r->pool, type, "; charset=",
- conf->add_default_charset_name, NULL);
+ /* see if it makes sense to add the charset. At present,
+ * we only add it if the Content-type is one of needcset[]
+ */
+ for (pcset = needcset; *pcset ; pcset++)
+ if (ap_strcasestr(type, *pcset) != NULL) {
+ type = ap_pstrcat(r->pool, type, "; charset=",
+ conf->add_default_charset_name, NULL);
+ break;
+ }
}
return type;
}
1.178 +32 -0 apache-1.3/src/main/util.c
Index: util.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/util.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- util.c 2000/02/02 20:43:51 1.177
+++ util.c 2000/02/20 01:14:48 1.178
@@ -303,6 +303,38 @@
return 0;
}
+/*
+ * Similar to standard strstr() but we ignore case in this version.
+ * Based on the strstr() implementation further below.
+ */
+API_EXPORT(char *) ap_strcasestr(const char *s1, const char *s2)
+{
+ char *p1, *p2;
+ if (*s2 == '\0') {
+ /* an empty s2 */
+ return((char *)s1);
+ }
+ while(1) {
+ for ( ; (*s1 != '\0') && (ap_tolower(*s1) != ap_tolower(*s2)); s1++);
+ if (*s1 == '\0') return(NULL);
+ /* found first character of s2, see if the rest matches */
+ p1 = (char *)s1;
+ p2 = (char *)s2;
+ while (ap_tolower(*++p1) == ap_tolower(*++p2)) {
+ if (*p1 == '\0') {
+ /* both strings ended together */
+ return((char *)s1);
+ }
+ }
+ if (*p2 == '\0') {
+ /* second string ended, a match */
+ break;
+ }
+ /* didn't find a match here, try starting at next character in s1 */
+ s1++;
+ }
+ return((char *)s1);
+}
/*
* Apache stub function for the regex libraries regexec() to make sure the
* whole regex(3) API is available through the Apache (exported) namespace.