iliaa           Mon May 28 23:52:13 2007 UTC

  Modified files:              
    /php-src/main       php_content_types.c 
    /php-src/ext/standard       url_scanner.c http_fopen_wrapper.c 
    /php-src/ext/iconv  iconv.c 
    /TSRM       tsrm_virtual_cwd.c 
    /php-src    run-tests.php 
  Log:
  
  MFB
  
  
http://cvs.php.net/viewvc.cgi/php-src/main/php_content_types.c?r1=1.34&r2=1.35&diff_format=u
Index: php-src/main/php_content_types.c
diff -u php-src/main/php_content_types.c:1.34 
php-src/main/php_content_types.c:1.35
--- php-src/main/php_content_types.c:1.34       Mon Jan  1 09:29:35 2007
+++ php-src/main/php_content_types.c    Mon May 28 23:52:13 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_content_types.c,v 1.34 2007/01/01 09:29:35 sebastian Exp $ */
+/* $Id: php_content_types.c,v 1.35 2007/05/28 23:52:13 iliaa Exp $ */
 
 #include "php.h"
 #include "SAPI.h"
@@ -37,21 +37,21 @@
  */
 SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
 {
-       char *data = NULL;
-       int length = 0;
+       char *data;
+       int length;
 
        /* $HTTP_RAW_POST_DATA registration */
-       if(!strcmp(SG(request_info).request_method, "POST")) {
-               if(NULL == SG(request_info).post_entry) {
+       if (!strcmp(SG(request_info).request_method, "POST")) {
+               if (NULL == SG(request_info).post_entry) {
                        /* no post handler registered, so we just swallow the 
data */
                        sapi_read_standard_form_data(TSRMLS_C);
+               }
+
+               /* For unknown content types we create HTTP_RAW_POST_DATA even 
if always_populate_raw_post_data off,
+                * this is in-effecient, but we need to keep doing it for BC 
reasons (for now) */
+               if ((PG(always_populate_raw_post_data) || NULL == 
SG(request_info).post_entry) && SG(request_info).post_data) {
                        length = SG(request_info).post_data_length;
                        data = estrndup(SG(request_info).post_data, length);
-               } else if(PG(always_populate_raw_post_data) && 
SG(request_info).post_data) {
-                       length = SG(request_info).post_data_length;
-                       data = estrndup(SG(request_info).post_data, length);
-               }
-               if(data) {
                        SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length);
                }
        }
@@ -62,11 +62,10 @@
         in the long run post handlers should be changed to not touch
         request_info.post_data for memory preservation reasons
        */
-       if(SG(request_info).post_data) {
+       if (SG(request_info).post_data) {
                SG(request_info).raw_post_data = 
estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
                SG(request_info).raw_post_data_length = 
SG(request_info).post_data_length;
        }
-
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/url_scanner.c?r1=1.46&r2=1.47&diff_format=u
Index: php-src/ext/standard/url_scanner.c
diff -u php-src/ext/standard/url_scanner.c:1.46 
php-src/ext/standard/url_scanner.c:1.47
--- php-src/ext/standard/url_scanner.c:1.46     Mon Jan  1 09:29:32 2007
+++ php-src/ext/standard/url_scanner.c  Mon May 28 23:52:13 2007
@@ -15,7 +15,7 @@
    | Author: Hartmut Holzgraefe <[EMAIL PROTECTED]>                        |
    +----------------------------------------------------------------------+
  */
-/* $Id: url_scanner.c,v 1.46 2007/01/01 09:29:32 sebastian Exp $ */
+/* $Id: url_scanner.c,v 1.47 2007/05/28 23:52:13 iliaa Exp $ */
 
 #include "php.h"
 
@@ -50,35 +50,24 @@
 static char *url_attr_addon(const char *tag,const char *attr,const char 
*val,const char *buf)
 {
        int flag = 0;
-       TSRMLS_FETCH();
 
-       if(!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
+       if (!strcasecmp(tag,"a") && !strcasecmp(attr,"href")) {
                flag = 1;
-       } else if(!strcasecmp(tag,"area" ) && !strcasecmp(attr,"href"   )) {
+       } else if (!strcasecmp(tag,"area" ) && !strcasecmp(attr,"href"   )) {
                flag = 1;
-       } else if(!strcasecmp(tag,"form" ) && !strcasecmp(attr,"action" )) {
+       } else if (!strcasecmp(tag,"form" ) && !strcasecmp(attr,"action" )) {
                flag = 1;
-       } else if(!strcasecmp(tag,"frame") && !strcasecmp(attr,"source" )) {
+       } else if (!strcasecmp(tag,"frame") && !strcasecmp(attr,"source" )) {
                flag = 1;
-       } else if(!strcasecmp(tag,"img"  ) && !strcasecmp(attr,"action" )) {
+       } else if (!strcasecmp(tag,"img"  ) && !strcasecmp(attr,"action" )) {
                flag = 1;
        }
-       if(flag) {              
-               if(!strstr(val,buf)&&!strchr(val,':'))
-                       {
-                               char *result = (char 
*)emalloc(strlen(buf)+strlen(PG(arg_separator).output)+1);
-                               int n;
-
-                               if(strchr(val,'?')) {
-                                       strcpy(result,PG(arg_separator).output);
-                                       n=strlen(PG(arg_separator).output);
-                               } else {
-                                       *result='?';
-                                       n=1;
-                               }
-                               strcpy(result+n,buf);
-                               return result;
-                       }
+       if(flag && !strstr(val,buf) && !strchr(val,':')) {
+               char *result;
+               TSRMLS_FETCH();
+
+               spprintf(&result, 0, "%s%s", (strchr(val,'?') ? 
PG(arg_separator).output : "?"), buf);
+               return result;
        } 
        return NULL;
 }
@@ -214,7 +203,7 @@
                                                        maxl+=l;
                                                        out=realloc(out,maxl);
                                                        outp=out+*newlen;
-                                                       strcpy(outp,p);
+                                                       strlcpy(outp,p,maxl);
                                                        outp+=l;
                                                        *newlen+=l;
                                                        efree(p);
@@ -230,7 +219,7 @@
                                                maxl+=l;
                                                out=realloc(out,maxl);
                                                outp=out+*newlen;
-                                               strcpy(outp,p);
+                                               strlcpy(outp, p, maxl);
                                                outp+=l;
                                                *newlen+=l;
                                                efree(p);
@@ -265,7 +254,7 @@
                                                maxl+=l;
                                                out=realloc(out,maxl);
                                                outp=out+*newlen;
-                                               strcpy(outp,p);
+                                               strlcpy(outp,p,maxl);
                                                outp+=l;
                                                *newlen+=l;
                                                efree(p);
@@ -282,7 +271,7 @@
                                                maxl+=l;
                                                out=realloc(out,maxl);
                                                outp=out+*newlen;
-                                               strcpy(outp,p);
+                                               strlcpy(outp,p,maxl);
                                                outp+=l;
                                                *newlen+=l;
                                                efree(p);
@@ -329,7 +318,7 @@
                                                maxl+=l;
                                                out=realloc(out,maxl);
                                                outp=out+*newlen;
-                                               strcpy(outp,p);
+                                               strlcpy(outp,p,maxl);
                                                outp+=l;
                                                *newlen+=l;
                                                efree(p);
@@ -346,7 +335,7 @@
                                                maxl+=l;
                                                out=realloc(out,maxl);
                                                outp=out+*newlen;
-                                               strcpy(outp,p);
+                                               strlcpy(outp,p,maxl);
                                                outp+=l;
                                                *newlen+=l;
                                                efree(p);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/http_fopen_wrapper.c?r1=1.125&r2=1.126&diff_format=u
Index: php-src/ext/standard/http_fopen_wrapper.c
diff -u php-src/ext/standard/http_fopen_wrapper.c:1.125 
php-src/ext/standard/http_fopen_wrapper.c:1.126
--- php-src/ext/standard/http_fopen_wrapper.c:1.125     Mon Apr 23 16:32:37 2007
+++ php-src/ext/standard/http_fopen_wrapper.c   Mon May 28 23:52:13 2007
@@ -19,7 +19,7 @@
    |          Sara Golemon <[EMAIL PROTECTED]>                              |
    +----------------------------------------------------------------------+
  */
-/* $Id: http_fopen_wrapper.c,v 1.125 2007/04/23 16:32:37 bjori Exp $ */ 
+/* $Id: http_fopen_wrapper.c,v 1.126 2007/05/28 23:52:13 iliaa Exp $ */ 
 
 #include "php.h"
 #include "php_globals.h"
@@ -146,11 +146,12 @@
        char *protocol_version = NULL;
        int protocol_version_len = 3; /* Default: "1.0" */
        char *charset = NULL;
+       struct timeval timeout;
 
        tmp_line[0] = '\0';
 
        if (redirect_max < 1) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Redirection limit 
reached, aborting");
+               php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, 
"Redirection limit reached, aborting");
                return NULL;
        }
 
@@ -202,9 +203,23 @@
                }
        }
 
+       if (context && php_stream_context_get_option(context, 
wrapper->wops->label, "timeout", &tmpzval) == SUCCESS) {
+               SEPARATE_ZVAL(tmpzval);
+               convert_to_double_ex(tmpzval);
+               timeout.tv_sec = (time_t) Z_DVAL_PP(tmpzval);
+               timeout.tv_usec = (size_t) ((Z_DVAL_PP(tmpzval) - 
timeout.tv_sec) * 1000000);
+       } else {
+               timeout.tv_sec = FG(default_socket_timeout);
+               timeout.tv_usec = 0;
+       }
+
        stream = php_stream_xport_create(transport_string, transport_len, 
options,
                        STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
-                       NULL, NULL, context, &errstr, NULL);
+                       NULL, &timeout, context, &errstr, NULL);
+    
+       if (stream) {
+               php_stream_set_option(stream, PHP_STREAM_OPTION_READ_TIMEOUT, 
0, &timeout);
+       }
                        
        if (errstr) {
                php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "%s", 
errstr);
@@ -275,8 +290,7 @@
                redirect_max = Z_LVAL_PP(tmpzval);
        }
 
-       if (header_init && context &&
-               php_stream_context_get_option(context, "http", "method", 
&tmpzval) == SUCCESS) {
+       if (context && php_stream_context_get_option(context, "http", "method", 
&tmpzval) == SUCCESS) {
                if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval) > 
0) {
                        scratch_len = strlen(path) + 29 + Z_STRLEN_PP(tmpzval);
                        scratch = emalloc(scratch_len);
@@ -284,9 +298,8 @@
                        strcat(scratch, " ");
                }
        }
-
-       if (context &&
-               php_stream_context_get_option(context, "http", 
"protocol_version", &tmpzval) == SUCCESS) {
+ 
+       if (context && php_stream_context_get_option(context, "http", 
"protocol_version", &tmpzval) == SUCCESS) {
                SEPARATE_ZVAL(tmpzval);
                convert_to_double_ex(tmpzval);
                protocol_version_len = spprintf(&protocol_version, 0, "%.1F", 
Z_DVAL_PP(tmpzval));
@@ -612,7 +625,11 @@
                }
        }
        
-       if (!reqok || location[0] != '\0')      {               
+       if (!reqok || location[0] != '\0') {
+               if (options & STREAM_ONLY_GET_HEADERS && redirect_max <= 1) {
+                       goto out;
+               }
+
                if (location[0] != '\0')
                        php_stream_notify_info(context, 
PHP_STREAM_NOTIFY_REDIRECTED, location, 0);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.152&r2=1.153&diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.152 php-src/ext/iconv/iconv.c:1.153
--- php-src/ext/iconv/iconv.c:1.152     Wed Jan 24 00:33:44 2007
+++ php-src/ext/iconv/iconv.c   Mon May 28 23:52:13 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: iconv.c,v 1.152 2007/01/24 00:33:44 tony2001 Exp $ */
+/* $Id: iconv.c,v 1.153 2007/05/28 23:52:13 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -363,8 +363,8 @@
                }
                
                if (mimetype != NULL && !(output_context->op & 
PHP_OUTPUT_HANDLER_CLEAN)) {
-                       spprintf(&content_type, 0, "Content-Type: %.*s; 
charset=%s", mimetype_len?mimetype_len:strlen(mimetype), mimetype, 
ICONVG(output_encoding));
-                       if (content_type && SUCCESS == 
sapi_add_header(content_type, strlen(content_type), 0)) {
+                       int len = spprintf(&content_type, 0, "Content-Type: 
%.*s; charset=%s", mimetype_len?mimetype_len:strlen(mimetype), mimetype, 
ICONVG(output_encoding));
+                       if (content_type && SUCCESS == 
sapi_add_header(content_type, len, 0)) {
                                SG(sapi_headers).send_default_content_type = 0;
                                
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
                        }
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.107&r2=1.108&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.107 TSRM/tsrm_virtual_cwd.c:1.108
--- TSRM/tsrm_virtual_cwd.c:1.107       Fri May 18 12:15:01 2007
+++ TSRM/tsrm_virtual_cwd.c     Mon May 28 23:52:13 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_virtual_cwd.c,v 1.107 2007/05/18 12:15:01 rasmus Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.108 2007/05/28 23:52:13 iliaa Exp $ */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -372,14 +372,15 @@
 
 static inline unsigned long realpath_cache_key(const char *path, int path_len)
 {
-  register unsigned long h;
+       register unsigned long h;
+       const char *e = path + path_len;
 
-  const char *e = path + path_len;
-  for (h = 2166136261U; path < e; ) {
-    h *= 16777619;
-    h ^= *path++;
-  }
-  return h;
+       for (h = 2166136261U; path < e;) {
+               h *= 16777619;
+               h ^= *path++;
+       }
+
+       return h;
 }
 
 CWD_API void realpath_cache_clean(TSRMLS_D)
@@ -436,7 +437,7 @@
                n = bucket->key % (sizeof(CWDG(realpath_cache)) / 
sizeof(CWDG(realpath_cache)[0]));
                bucket->next = CWDG(realpath_cache)[n];
                CWDG(realpath_cache)[n] = bucket;
-         CWDG(realpath_cache_size) += size;
+               CWDG(realpath_cache_size) += size;
        }
 }
 
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.324&r2=1.325&diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.324 php-src/run-tests.php:1.325
--- php-src/run-tests.php:1.324 Sun May 27 19:22:24 2007
+++ php-src/run-tests.php       Mon May 28 23:52:13 2007
@@ -24,7 +24,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: run-tests.php,v 1.324 2007/05/27 19:22:24 tony2001 Exp $ */
+/* $Id: run-tests.php,v 1.325 2007/05/28 23:52:13 iliaa Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -406,7 +406,7 @@
                                        $html_output = is_resource($html_file);
                                        break;
                                case '--version':
-                                       echo '$Revision: 1.324 $'."\n";
+                                       echo '$Revision: 1.325 $'."\n";
                                        exit(1);
                                default:
                                        echo "Illegal switch specified!\n";
@@ -1391,6 +1391,15 @@
        } elseif (array_key_exists('POST', $section_text) && 
!empty($section_text['POST'])) {
 
                $post = trim($section_text['POST']);
+
+               if (array_key_exists('GZIP_POST', $section_text) && 
function_exists('gzencode')) {
+                       $post = gzencode($post, 9, FORCE_GZIP);
+                       $env['HTTP_CONTENT_ENCODING'] = 'gzip';
+               } else if (array_key_exists('DEFLATE_POST', $section_text) && 
function_exists('gzcompress')) {
+                       $post = gzcompress($post, 9);
+                       $env['HTTP_CONTENT_ENCODING'] = 'deflate';
+               }
+
                save_text($tmp_post, $post);
                $content_length = strlen($post);
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to