cvs: pecl /http http_methods.c

From: Date: Mon, 30 May 2005 15:26:37 +0000
Subject: cvs: pecl /http http_methods.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-3200@lists.php.net to get a copy of this message
mike Mon May 30 11:26:37 2005 EDT Modified files: /pecl/http http_methods.c Log: - add clean_ob parameter to HttpResponse::send() http://cvs.php.net/diff.php/pecl/http/http_methods.c?r1=1.40&r2=1.41&ty=u Index: pecl/http/http_methods.c diff -u pecl/http/http_methods.c:1.40 pecl/http/http_methods.c:1.41 --- pecl/http/http_methods.c:1.40 Wed May 25 12:45:00 2005 +++ pecl/http/http_methods.c Mon May 30 11:26:35 2005 @@ -13,7 +13,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: http_methods.c,v 1.40 2005/05/25 16:45:00 mike Exp $ */ +/* $Id: http_methods.c,v 1.41 2005/05/30 15:26:35 mike Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -507,7 +507,7 @@ } /* }}} */ -/* {{{ proto bool HttpResponse::send() +/* {{{ proto bool HttpResponse::send([bool clean_ob = true]) * * Finally send the entity. * @@ -524,14 +524,24 @@ */ PHP_METHOD(HttpResponse, send) { + zend_bool clean_ob = 1; zval *do_cache, *do_gzip; getObject(http_response_object, obj); - NO_ARGS; + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &clean_ob)) { + RETURN_FALSE; + } do_cache = GET_PROP(obj, cache); do_gzip = GET_PROP(obj, gzip); + if (clean_ob) { + /* interrupt on-the-fly etag generation */ + HTTP_G(etag).started = 0; + /* discard previous output buffers */ + php_end_ob_buffers(0 TSRMLS_CC); + } + /* gzip */ if (Z_LVAL_P(do_gzip)) { php_start_ob_buffer_named("ob_gzhandler", 0, 1 TSRMLS_CC); @@ -622,29 +632,6 @@ /* {{{ HttpMessage */ -/* {{{ proto static HttpMessage HttpMessage::fromString(string raw_message) - * - * Create an HttpMessage object from a string. - */ -PHP_METHOD(HttpMessage, fromString) -{ - char *string = NULL; - int length = 0; - http_message *msg = NULL; - - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &length)) { - RETURN_NULL(); - } - - if (!(msg = http_message_parse(string, length))) { - RETURN_NULL(); - } - - Z_TYPE_P(return_value) = IS_OBJECT; - return_value->value.obj = http_message_object_from_msg(msg); -} -/* }}} */ - /* {{{ proto void HttpMessage::__construct([string message]) * * Instantiate a new HttpMessage object. @@ -669,6 +656,29 @@ } /* }}} */ +/* {{{ proto static HttpMessage HttpMessage::fromString(string raw_message) + * + * Create an HttpMessage object from a string. + */ +PHP_METHOD(HttpMessage, fromString) +{ + char *string = NULL; + int length = 0; + http_message *msg = NULL; + + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &length)) { + RETURN_NULL(); + } + + if (!(msg = http_message_parse(string, length))) { + RETURN_NULL(); + } + + Z_TYPE_P(return_value) = IS_OBJECT; + return_value->value.obj = http_message_object_from_msg(msg); +} +/* }}} */ + /* {{{ proto string HttpMessage::getBody() * * Get the body of the parsed Message.

« previous php.pecl.cvs (#3200) next »