X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_response_object.c;h=c95956c853600a5b205fdefb695373efe53faf6f;hp=5303d2d0ed76bd1c934b2428dad2ad8a5d3dc652;hb=6deee2e3d2d6282dd76e3725fe2de6c7833bd57f;hpb=445dd5f0580e5073d69d3ef7267671686e18f4e7 diff --git a/http_response_object.c b/http_response_object.c index 5303d2d..c95956c 100644 --- a/http_response_object.c +++ b/http_response_object.c @@ -25,6 +25,7 @@ #include "SAPI.h" #include "php_ini.h" +#include "ext/standard/head.h" #include "php_http.h" #include "php_http_api.h" @@ -47,6 +48,7 @@ ZEND_EXTERN_MODULE_GLOBALS(http); #define HTTP_BEGIN_ARGS(method, req_args) HTTP_BEGIN_ARGS_EX(HttpResponse, method, 0, req_args) #define HTTP_EMPTY_ARGS(method, ret_ref) HTTP_EMPTY_ARGS_EX(HttpResponse, method, ret_ref) #define HTTP_RESPONSE_ME(method, visibility) PHP_ME(HttpResponse, method, HTTP_ARGS(HttpResponse, method), visibility|ZEND_ACC_STATIC) +#define HTTP_RESPONSE_ALIAS(method, func) HTTP_STATIC_ME_ALIAS(method, func, HTTP_ARGS(HttpResponse, method)) HTTP_EMPTY_ARGS(getETag, 0); HTTP_BEGIN_ARGS(setETag, 1) @@ -111,6 +113,26 @@ HTTP_END_ARGS; HTTP_EMPTY_ARGS(capture, 0); +HTTP_BEGIN_ARGS(redirect, 0) + HTTP_ARG_VAL(url, 0) + HTTP_ARG_VAL(params, 0) + HTTP_ARG_VAL(session, 0) + HTTP_ARG_VAL(permanent, 0) +HTTP_END_ARGS; + +HTTP_BEGIN_ARGS(sendStatus, 1) + HTTP_ARG_VAL(status, 0) +HTTP_END_ARGS; + +HTTP_BEGIN_ARGS(sendHeader, 1) + HTTP_ARG_VAL(header, 0) + HTTP_ARG_VAL(replace, 0) + HTTP_ARG_VAL(status, 0) +HTTP_END_ARGS; + +HTTP_EMPTY_ARGS(getRequestHeaders, 0); +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); @@ -153,6 +175,14 @@ zend_function_entry http_response_object_fe[] = { HTTP_RESPONSE_ME(send, ZEND_ACC_PUBLIC) HTTP_RESPONSE_ME(capture, ZEND_ACC_PUBLIC) + HTTP_RESPONSE_ALIAS(redirect, http_redirect) + + HTTP_RESPONSE_ALIAS(sendStatus, http_send_status) + HTTP_RESPONSE_ALIAS(sendHeader, header) + + HTTP_RESPONSE_ALIAS(getRequestHeaders, http_get_request_headers) + HTTP_RESPONSE_ALIAS(getRequestBody, http_get_request_body) + {NULL, NULL, NULL} }; @@ -469,7 +499,7 @@ PHP_METHOD(HttpResponse, getBufferSize) */ PHP_METHOD(HttpResponse, setData) { - zval *the_data, **data; + zval *the_data; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &the_data)) { RETURN_FALSE; @@ -601,7 +631,7 @@ PHP_METHOD(HttpResponse, getFile) */ PHP_METHOD(HttpResponse, send) { - zval *do_cache, *do_gzip, *sent; + zval *sent; zend_bool clean_ob = 1; if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &clean_ob)) { @@ -655,8 +685,6 @@ PHP_METHOD(HttpResponse, send) /* caching */ if (Z_LVAL_P(GET_STATIC_PROP(cache))) { - char *cc_hdr; - int cc_len; zval *cctl, *etag, *lmod; etag = GET_STATIC_PROP(eTag);