- use global send buffer size for output buffering, as we'll flush anyways after...
authorMichael Wallner <mike@php.net>
Tue, 4 Oct 2005 14:00:12 +0000 (14:00 +0000)
committerMichael Wallner <mike@php.net>
Tue, 4 Oct 2005 14:00:12 +0000 (14:00 +0000)
http_cache_api.c
http_response_object.c

index d03ee85c2c17bae53da40b24e2edb9055f1be025..5eca48a6650576054b7b8a844e1da6a89b8c7bf2 100644 (file)
@@ -215,7 +215,7 @@ PHP_HTTP_API STATUS _http_cache_etag(const char *etag, size_t etag_len,
                return SUCCESS;
        }
 
-       if (HTTP_G(etag).started = (SUCCESS == php_start_ob_buffer_named("ob_etaghandler", HTTP_SENDBUF_SIZE, 1 TSRMLS_CC))) {
+       if (HTTP_G(etag).started = (SUCCESS == php_start_ob_buffer_named("ob_etaghandler", HTTP_G(send).buffer_size, 1 TSRMLS_CC))) {
                return SUCCESS;
        } else {
                return FAILURE;
index 37c45f8c65d1a379abc16d374f30fd435b313407..366cf9dddff0de8c0455707a062186bdd516145c 100644 (file)
@@ -944,13 +944,6 @@ PHP_METHOD(HttpResponse, send)
                php_end_ob_buffers(0 TSRMLS_CC);
        }
 
-       /* gzip */
-       if (zval_is_true(GET_STATIC_PROP(gzip))) {
-               php_start_ob_buffer_named("ob_gzhandler", 0, 0 TSRMLS_CC);
-       } else {
-               php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
-       }
-
        /* caching */
        if (zval_is_true(GET_STATIC_PROP(cache))) {
                zval *cctl, *etag, *lmod;
@@ -994,29 +987,34 @@ PHP_METHOD(HttpResponse, send)
                HTTP_G(send).throttle_delay = Z_DVAL_P(convert_to_type_ex(IS_DOUBLE, GET_STATIC_PROP(throttleDelay)));
        }
 
+       /* gzip */
+       if (zval_is_true(GET_STATIC_PROP(gzip))) {
+               php_start_ob_buffer_named("ob_gzhandler", HTTP_G(send).buffer_size, 0 TSRMLS_CC);
+       } else {
+               php_start_ob_buffer(NULL, HTTP_G(send).buffer_size, 0 TSRMLS_CC);
+       }
+
        /* send */
+       switch (Z_LVAL_P(GET_STATIC_PROP(mode)))
        {
-               switch (Z_LVAL_P(GET_STATIC_PROP(mode)))
+               case SEND_DATA:
                {
-                       case SEND_DATA:
-                       {
-                               zval *zdata = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(data));
-                               RETURN_SUCCESS(http_send_data_ex(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata), 1));
-                       }
+                       zval *zdata = convert_to_type_ex(IS_STRING, GET_STATIC_PROP(data));
+                       RETURN_SUCCESS(http_send_data_ex(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata), 1));
+               }
 
-                       case SEND_RSRC:
-                       {
-                               php_stream *the_real_stream;
-                               zval *the_stream = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(stream));
-                               the_stream->type = IS_RESOURCE;
-                               php_stream_from_zval(the_real_stream, &the_stream);
-                               RETURN_SUCCESS(http_send_stream_ex(the_real_stream, 0, 1));
-                       }
+               case SEND_RSRC:
+               {
+                       php_stream *the_real_stream;
+                       zval *the_stream = convert_to_type_ex(IS_LONG, GET_STATIC_PROP(stream));
+                       the_stream->type = IS_RESOURCE;
+                       php_stream_from_zval(the_real_stream, &the_stream);
+                       RETURN_SUCCESS(http_send_stream_ex(the_real_stream, 0, 1));
+               }
 
-                       default:
-                       {
-                               RETURN_SUCCESS(http_send_file_ex(Z_STRVAL_P(convert_to_type_ex(IS_STRING, GET_STATIC_PROP(file))), 1));
-                       }
+               default:
+               {
+                       RETURN_SUCCESS(http_send_file_ex(Z_STRVAL_P(convert_to_type_ex(IS_STRING, GET_STATIC_PROP(file))), 1));
                }
        }
 }
@@ -1042,7 +1040,7 @@ PHP_METHOD(HttpResponse, capture)
        UPD_STATIC_PROP(long, catch, 1);
 
        php_end_ob_buffers(0 TSRMLS_CC);
-       php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
+       php_start_ob_buffer(NULL, 40960, 0 TSRMLS_CC);
 
        /* register shutdown function */
        {