projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- no need for additional configure argument; just check and enable
[m6w6/ext-http]
/
http_response_object.c
diff --git
a/http_response_object.c
b/http_response_object.c
index 666040b9aaf44f485562fa432630ce23680afb73..ea24fd897bacd04dad48222fe45b722a9b22f6e5 100644
(file)
--- a/
http_response_object.c
+++ b/
http_response_object.c
@@
-21,7
+21,10
@@
#endif
#include "php.h"
#endif
#include "php.h"
-#ifdef ZEND_ENGINE_2
+#include "missing.h"
+
+/* broken static properties in PHP 5.0 */
+#if defined(ZEND_ENGINE_2) && !defined(WONKY)
#include "SAPI.h"
#include "php_ini.h"
#include "SAPI.h"
#include "php_ini.h"
@@
-34,8
+37,6
@@
#include "php_http_send_api.h"
#include "php_http_cache_api.h"
#include "php_http_send_api.h"
#include "php_http_cache_api.h"
-#include "missing.h"
-
ZEND_EXTERN_MODULE_GLOBALS(http);
#define GET_STATIC_PROP(n) *GET_STATIC_PROP_EX(http_response_object_ce, n)
ZEND_EXTERN_MODULE_GLOBALS(http);
#define GET_STATIC_PROP(n) *GET_STATIC_PROP_EX(http_response_object_ce, n)
@@
-142,8
+143,6
@@
HTTP_EMPTY_ARGS(getRequestBody, 0);
#define http_response_object_declare_default_properties() _http_response_object_declare_default_properties(TSRMLS_C)
static inline void _http_response_object_declare_default_properties(TSRMLS_D);
#define http_response_object_declare_default_properties() _http_response_object_declare_default_properties(TSRMLS_C)
static inline void _http_response_object_declare_default_properties(TSRMLS_D);
-HashTable http_response_statics;
-
zend_class_entry *http_response_object_ce;
zend_function_entry http_response_object_fe[] = {
zend_class_entry *http_response_object_ce;
zend_function_entry http_response_object_fe[] = {
@@
-773,19
+772,19
@@
PHP_METHOD(HttpResponse, send)
/* capture mode */
if (Z_BVAL_P(GET_STATIC_PROP(catch))) {
/* capture mode */
if (Z_BVAL_P(GET_STATIC_PROP(catch))) {
- zval the_data;
+ zval
*
the_data;
-
INIT_PZVAL(&
the_data);
- php_ob_get_buffer(
&
the_data TSRMLS_CC);
- SET_STATIC_PROP(data,
&
the_data);
+
MAKE_STD_ZVAL(
the_data);
+ php_ob_get_buffer(the_data TSRMLS_CC);
+ SET_STATIC_PROP(data, the_data);
ZVAL_LONG(GET_STATIC_PROP(mode), SEND_DATA);
if (!Z_STRLEN_P(GET_STATIC_PROP(eTag))) {
ZVAL_LONG(GET_STATIC_PROP(mode), SEND_DATA);
if (!Z_STRLEN_P(GET_STATIC_PROP(eTag))) {
- char *etag = http_etag(Z_STRVAL
(the_data), Z_STRLEN
(the_data), SEND_DATA);
+ char *etag = http_etag(Z_STRVAL
_P(the_data), Z_STRLEN_P
(the_data), SEND_DATA);
UPD_STATIC_PROP(string, eTag, etag);
efree(etag);
}
UPD_STATIC_PROP(string, eTag, etag);
efree(etag);
}
- zval_dtor(&the_data);
+ zval_
ptr_
dtor(&the_data);
clean_ob = 1;
}
clean_ob = 1;
}
@@
-879,7
+878,7
@@
PHP_METHOD(HttpResponse, send)
case SEND_DATA:
{
zval *zdata = GET_STATIC_PROP(data);
case SEND_DATA:
{
zval *zdata = GET_STATIC_PROP(data);
- RETURN_SUCCESS(http_send_data
(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata)
));
+ RETURN_SUCCESS(http_send_data
_ex(Z_STRVAL_P(zdata), Z_STRLEN_P(zdata), 1
));
}
case SEND_RSRC:
}
case SEND_RSRC:
@@
-888,12
+887,12
@@
PHP_METHOD(HttpResponse, send)
zval *the_stream = GET_STATIC_PROP(stream);
the_stream->type = IS_RESOURCE;
php_stream_from_zval(the_real_stream, &the_stream);
zval *the_stream = GET_STATIC_PROP(stream);
the_stream->type = IS_RESOURCE;
php_stream_from_zval(the_real_stream, &the_stream);
- RETURN_SUCCESS(http_send_stream
(the_real_stream
));
+ RETURN_SUCCESS(http_send_stream
_ex(the_real_stream, 0, 1
));
}
default:
{
}
default:
{
- RETURN_SUCCESS(http_send_file
(Z_STRVAL_P(GET_STATIC_PROP(file))
));
+ RETURN_SUCCESS(http_send_file
_ex(Z_STRVAL_P(GET_STATIC_PROP(file)), 1
));
}
}
}
}
}
}
@@
-910,10
+909,6
@@
PHP_METHOD(HttpResponse, send)
* HttpResponse::setCache(true);
* HttpResponse::capture();
* // script follows
* HttpResponse::setCache(true);
* HttpResponse::capture();
* // script follows
- * // note that you need to call
- * HttpResponse::send();
- * // at the end of the script unless
- * // you use PHP-5.1 or greater
* ?>
* </pre>
*/
* ?>
* </pre>
*/
@@
-931,7
+926,7
@@
PHP_METHOD(HttpResponse, capture)
php_end_ob_buffers(0 TSRMLS_CC);
php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
php_end_ob_buffers(0 TSRMLS_CC);
php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
-#if
(PHP_MAJOR_VERSION > 5) || (PHP_MINOR_VERSION > 0)
+#if
ndef WONKY
/* register shutdown function --
messing around with ob and headers only works in PHP-5.1 or greater */
{
/* register shutdown function --
messing around with ob and headers only works in PHP-5.1 or greater */
{
@@
-953,7
+948,7
@@
PHP_METHOD(HttpResponse, capture)
}
/* }}} */
}
/* }}} */
-#endif /* ZEND_ENGINE_2 */
+#endif /* ZEND_ENGINE_2
&& !WONKY
*/
/*
* Local variables:
/*
* Local variables: