cvs: /php4 rfc1867.c /php4/ext/standard post.c post.h
| From: | Zeev Suraski | Date: | Sat, 11 Sep 1999 13:44:23 +0000 |
| Subject: | cvs: /php4 rfc1867.c /php4/ext/standard post.c post.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4320@lists.php.net to get a copy of this message | ||
zeev Sat Sep 11 09:44:23 1999 EDT
Modified files:
/php4 rfc1867.c
/php4/ext/standard post.c post.h
Log:
Cleanups
Index: php4/rfc1867.c
diff -u php4/rfc1867.c:1.7 php4/rfc1867.c:1.8
--- php4/rfc1867.c:1.7 Mon Aug 2 15:16:34 1999
+++ php4/rfc1867.c Sat Sep 11 09:44:23 1999
@@ -15,7 +15,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.7 1999/08/02 19:16:34 zeev Exp $ */
+/* $Id: rfc1867.c,v 1.8 1999/09/11 13:44:23 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -159,7 +159,7 @@
*(loc - 4) = '\0';
/* Magic function that figures everything out */
- _php3_parse_gpc_data(ptr,namebuf,http_post_vars);
+ php_parse_gpc_data(ptr,namebuf,http_post_vars);
/* And a little kludge to pick out special MAX_FILE_SIZE */
itype = php3_check_ident_type(namebuf);
Index: php4/ext/standard/post.c
diff -u php4/ext/standard/post.c:1.18 php4/ext/standard/post.c:1.19
--- php4/ext/standard/post.c:1.18 Sat Sep 4 09:18:56 1999
+++ php4/ext/standard/post.c Sat Sep 11 09:44:23 1999
@@ -25,128 +25,6 @@
#include "zend_globals.h"
-/*
- * php3_getpost()
- *
- * This reads the post form data into a string.
- * Remember to free this pointer when done with it.
- */
-#if 0
-static char *php3_getpost(pval *http_post_vars PLS_DC)
-{
- char *buf = NULL;
- const char *ctype;
-#if MODULE_MAGIC_NUMBER > 19961007
- char argsbuffer[HUGE_STRING_LEN];
-#else
- int bytes;
-#endif
- int length, cnt;
- int file_upload = 0;
- char *mb;
- char boundary[100];
- SLS_FETCH();
-
- ctype = request_info.content_type;
- if (!ctype) {
- php_error(E_WARNING, "POST Error: content-type missing");
- return NULL;
- }
- if (strncasecmp(ctype, "application/x-www-form-urlencoded", 33) &&
strncasecmp(ctype, "multipart/form-data", 19)
-#if HAVE_FDFLIB
- && strncasecmp(ctype, "application/vnd.fdf", 19)
-#endif
- ) {
- php_error(E_WARNING, "Unsupported content-type: %s", ctype);
- return NULL;
- }
- if (!strncasecmp(ctype, "multipart/form-data", 19)) {
- file_upload = 1;
- mb = strchr(ctype, '=');
- if (mb) {
- strncpy(boundary, mb + 1, sizeof(boundary));
- } else {
- php_error(E_WARNING, "File Upload Error: No MIME boundary found");
- php_error(E_WARNING, "There should have been a \"boundary=something\" in the
Content-Type string");
- php_error(E_WARNING, "The Content-Type string was: \"%s\"", ctype);
- return NULL;
- }
- }
- length = request_info.content_length;
- cnt = length;
- buf = (char *) emalloc((length + 1) * sizeof(char));
- if (!buf) {
- php_error(E_WARNING, "Unable to allocate memory in php3_getpost()");
- return NULL;
- }
-#if FHTTPD
- memcpy(buf,req->databuffer,length);
- buf[length]=0;
-#else
-#if MODULE_MAGIC_NUMBER > 19961007
- if (should_client_block(SG(server_context))) {
- void (*handler) (int);
- int dbsize, len_read, dbpos = 0;
-
- hard_timeout("copy script args", ((request_rec *) SG(server_context))); /* start
timeout timer */
- handler = signal(SIGPIPE, SIG_IGN); /* Ignore sigpipes for now */
- while ((len_read = get_client_block(((request_rec *) SG(server_context)), argsbuffer,
HUGE_STRING_LEN)) > 0) {
- if ((dbpos + len_read) > length)
- dbsize = length - dbpos;
- else
- dbsize = len_read;
- reset_timeout(((request_rec *) SG(server_context))); /* Make sure we don't timeout */
- memcpy(buf + dbpos, argsbuffer, dbsize);
- dbpos += dbsize;
- }
- signal(SIGPIPE, handler); /* restore normal sigpipe handling */
- kill_timeout(((request_rec *) SG(server_context))); /* stop timeout timer */
- }
-#else
- cnt = 0;
- do {
-#if APACHE
- bytes = read_client_block(((request_rec *) SG(server_context)), buf + cnt, length - cnt);
-#endif
-#if CGI_BINARY
- bytes = fread(buf + cnt, 1, length - cnt, stdin);
-#endif
-#if USE_SAPI
- bytes = sapi_rqst->readclient(sapi_rqst->scid,buf + cnt, 1, length - cnt);
-#endif
- cnt += bytes;
- } while (bytes && cnt < length);
-#endif
-#endif
- if (file_upload) {
- php3_mime_split(buf, cnt, boundary, http_post_vars PLS_CC);
- efree(buf);
- return NULL;
- }
- buf[cnt] = '\0';
-
-#if HAVE_FDFLIB
- if (!strncasecmp(ctype, "application/vnd.fdf", 19)) {
- pval *postdata_ptr = (pval *) emalloc(sizeof(pval));
-
- postdata_ptr->type = IS_STRING;
- postdata_ptr->value.str.val = (char *) estrdup(buf);
- postdata_ptr->value.str.len = cnt;
- INIT_PZVAL(postdata_ptr);
- zend_hash_add(&symbol_table, "HTTP_FDF_DATA", sizeof("HTTP_FDF_DATA"),
postdata_ptr, sizeof(pval *),NULL);
- }
-#endif
- return (buf);
-}
-#else
-static char *php3_getpost(pval *http_post_vars PLS_DC)
-{
- SLS_FETCH();
-
- return SG(request_info).post_data;
-}
-#endif
-
/*
* parse Get/Post/Cookie string and create appropriate variable
@@ -155,7 +33,7 @@
* the old TreatData function. This is a temporary measure filling
* the gap until a more flexible parser can be built to do this.
*/
-void _php3_parse_gpc_data(char *val, char *var, pval *track_vars_array)
+void php_parse_gpc_data(char *val, char *var, pval *track_vars_array)
{
int var_type;
char *ind, *tmp = NULL, *ret = NULL;
@@ -336,7 +214,7 @@
}
if (arg == PARSE_POST) { /* POST data */
- res = php3_getpost(array_ptr PLS_CC);
+ res = SG(request_info).post_data;
free_buffer = 0;
} else if (arg == PARSE_GET) { /* GET data */
var = SG(request_info).query_string;
@@ -377,7 +255,7 @@
/* FIXME: XXX: not binary safe, discards returned length */
_php3_urldecode(var, strlen(var));
_php3_urldecode(val, strlen(val));
- _php3_parse_gpc_data(val,var,array_ptr);
+ php_parse_gpc_data(val,var,array_ptr);
}
if (arg == PARSE_COOKIE) {
var = strtok(NULL, ";");
Index: php4/ext/standard/post.h
diff -u php4/ext/standard/post.h:1.2 php4/ext/standard/post.h:1.3
--- php4/ext/standard/post.h:1.2 Mon Apr 26 10:00:49 1999
+++ php4/ext/standard/post.h Sat Sep 11 09:44:23 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: post.h,v 1.2 1999/04/26 14:00:49 zeev Exp $ */
+/* $Id: post.h,v 1.3 1999/09/11 13:44:23 zeev Exp $ */
#ifndef _POST_H
#define _POST_H
@@ -37,7 +37,7 @@
#define PARSE_STRING 3
void php3_treat_data(int arg, char *str);
-void _php3_parse_gpc_data(char *, char *, pval *track_vars_array);
+void php_parse_gpc_data(char *, char *, pval *track_vars_array);
PHPAPI void php3_TreatHeaders(void);
#endif