#include "SAPI.h"
#include "php_ini.h"
+#include "ext/standard/head.h"
#include "php_http.h"
#include "php_http_api.h"
#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)
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);
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}
};
DCL_STATIC_PROP_N(PROTECTED, contentDisposition);
DCL_STATIC_PROP(PROTECTED, long, bufferSize, HTTP_SENDBUF_SIZE);
DCL_STATIC_PROP(PROTECTED, double, throttleDelay, 0.0);
-
- DCL_STATIC_PROP(PUBLIC, string, dummy, "EMPTY");
}
/* ### USERLAND ### */
}
if (strcmp(ccontrol, "public") && strcmp(ccontrol, "private") && strcmp(ccontrol, "no-cache")) {
- http_error_ex(E_WARNING, HTTP_E_PARAM, "Cache-Control '%s' doesn't match public, private or no-cache", ccontrol);
+ http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Cache-Control '%s' doesn't match public, private or no-cache", ccontrol);
RETURN_FALSE;
} else {
USE_STATIC_PROP();
}
if (!strchr(ctype, '/')) {
- http_error_ex(E_WARNING, HTTP_E_PARAM, "Content type '%s' doesn't seem to contain a primary and a secondary part", ctype);
+ http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Content type '%s' doesn't seem to contain a primary and a secondary part", ctype);
RETURN_FALSE;
}
RETURN_FALSE;
}
if (SG(headers_sent)) {
- http_error(E_WARNING, HTTP_E_HEADER, "Cannot send HttpResponse, headers have already been sent");
+ http_error(HE_WARNING, HTTP_E_RESPONSE, "Cannot send HttpResponse, headers have already been sent");
RETURN_FALSE;
}
sent = GET_STATIC_PROP(sent);
if (Z_LVAL_P(sent)) {
- http_error(E_WARNING, HTTP_E_UNKOWN, "Cannot send HttpResponse, response has already been sent");
+ http_error(HE_WARNING, HTTP_E_RESPONSE, "Cannot send HttpResponse, response has already been sent");
RETURN_FALSE;
} else {
Z_LVAL_P(sent) = 1;