Index: functions/post.c
===================================================================
RCS file: /repository/php3/functions/post.c,v
retrieving revision 1.122
diff -u -r1.122 post.c
--- functions/post.c 1999/06/01 12:44:48 1.122
+++ functions/post.c 1999/06/28 01:03:02
@@ -141,6 +141,7 @@
#endif
int length, cnt;
int file_upload = 0;
+ int unknown_content_type = 0;
char *mb;
char boundary[100];
TLS_VARS;
@@ -156,8 +157,10 @@
#endif
) {
php3_error(E_WARNING, "Unsupported content-type: %s", ctype);
- return NULL;
+ unknown_content_type = 1;
}
+
+ /* if this is a POST file upload, figure out the boundary */
if (!strncasecmp(ctype, "multipart/form-data", 19)) {
file_upload = 1;
mb = strchr(ctype, '=');
@@ -170,6 +173,8 @@
return NULL;
}
}
+
+ /* read in all of the data */
length = GLOBAL(request_info).content_length;
cnt = length;
buf = (char *) emalloc((length + 1) * sizeof(char));
@@ -178,8 +183,8 @@
return NULL;
}
#if FHTTPD
- memcpy(buf,req->databuffer,length);
- buf[length]=0;
+ memcpy(buf,req->databuffer,length);
+ buf[length]=0;
#else
#if MODULE_MAGIC_NUMBER > 19961007
if (should_client_block(GLOBAL(php3_rqst))) {
@@ -216,6 +221,8 @@
} while (bytes && cnt < length);
#endif
#endif
+
+ /* if it was a POST file upload, pass it off to someone else */
if (file_upload) {
php3_mime_split(buf, cnt, boundary, http_post_vars);
efree(buf);
@@ -233,6 +240,19 @@
_php3_hash_add(&GLOBAL(symbol_table), "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"), postdata_ptr, sizeof(pval),NULL);
}
#endif
+
+ if (unknown_content_type) {
+ pval rawdata;
+ rawdata.type = IS_STRING;
+ /* we don't need to copy buf, it was allocated with emalloc.
+ and we return NULL so nobody else will be trying to free it.
+ */
+ rawdata.value.str.val = buf;
+ rawdata.value.str.len = cnt;
+ _php3_hash_add(&GLOBAL(symbol_table), "HTTP_RAW_POST_DATA", sizeof("HTTP_RAW_POST_DATA"), &rawdata, sizeof(pval), NULL);
+ return NULL;
+ }
+
return (buf);
}

