if (!list) {
list = emalloc(sizeof(*list));
}
-
+
zend_hash_init(&list->cookies, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_init(&list->extras, 0, NULL, ZVAL_PTR_DTOR, 0);
-
+
list->path = NULL;
list->domain = NULL;
list->expires = -1;
list->max_age = -1;
list->flags = 0;
-
+
return list;
}
if (list) {
zend_hash_destroy(&list->cookies);
zend_hash_destroy(&list->extras);
-
+
PTR_SET(list->path, NULL);
PTR_SET(list->domain, NULL);
}
{
zval cookies, extras, tmp;
HashTable *ht = HASH_OF(strct);
-
+
array_init_size(&cookies, zend_hash_num_elements(&list->cookies));
array_copy(&list->cookies, Z_ARRVAL(cookies));
zend_symtable_str_update(ht, ZEND_STRL("cookies"), &cookies);
-
+
array_init_size(&extras, zend_hash_num_elements(&list->extras));
array_copy(&list->extras, Z_ARRVAL(extras));
zend_symtable_str_update(ht, ZEND_STRL("extras"), &extras);
-
+
ZVAL_LONG(&tmp, list->flags);
zend_symtable_str_update(ht, ZEND_STRL("flags"), &tmp);
ZVAL_LONG(&tmp, list->expires);
list->domain = estrndup(str->val, str->len);
zend_string_release(str);
}
-
+
return list;
}
static inline void append_encoded(php_http_buffer_t *buf, const char *key, size_t key_len, const char *val, size_t val_len)
{
zend_string *enc_str[2];
-
+
enc_str[0] = php_raw_url_encode(key, key_len);
enc_str[1] = php_raw_url_encode(val, val_len);
-
+
php_http_buffer_append(buf, enc_str[0]->val, enc_str[0]->len);
php_http_buffer_appends(buf, "=");
php_http_buffer_append(buf, enc_str[1]->val, enc_str[1]->len);
php_http_buffer_appends(buf, "; ");
-
+
zend_string_release(enc_str[0]);
zend_string_release(enc_str[1]);
}
php_http_buffer_t buf;
zend_hash_key key;
zval *val;
-
+
php_http_buffer_init(&buf);
ZEND_HASH_FOREACH_KEY_VAL(&list->cookies, key.h, key.key, val)
zend_string_release(str);
}
ZEND_HASH_FOREACH_END();
-
+
if (list->domain && *list->domain) {
php_http_buffer_appendf(&buf, "domain=%s; ", list->domain);
}
if (list->max_age >= 0) {
php_http_buffer_appendf(&buf, "max-age=%ld; ", list->max_age);
}
-
+
ZEND_HASH_FOREACH_KEY_VAL(&list->extras, key.h, key.key, val)
{
zend_string *str = zval_get_string(val);
zend_string_release(str);
}
ZEND_HASH_FOREACH_END();
-
+
if (list->flags & PHP_HTTP_COOKIE_SECURE) {
php_http_buffer_appends(&buf, "secure; ");
}
if (list->flags & PHP_HTTP_COOKIE_HTTPONLY) {
php_http_buffer_appends(&buf, "httpOnly; ");
}
-
+
php_http_buffer_fix(&buf);
*str = buf.data;
*len = buf.used;
}
ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toString, 0, 0, 0)
-ZEND_END_ARG_INFO();;
+ZEND_END_ARG_INFO();
static PHP_METHOD(HttpCookie, toString)
{
php_http_cookie_object_t *obj;
php_http_cookie_list_to_struct(obj->list, return_value);
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpCookie___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_cookie_methods[] = {
PHP_ME(HttpCookie, __construct, ai_HttpCookie___construct, ZEND_ACC_PUBLIC)
PHP_ME(HttpCookie, getCookies, ai_HttpCookie_getCookies, ZEND_ACC_PUBLIC)
PHP_ME(HttpCookie, toArray, ai_HttpCookie_toArray, ZEND_ACC_PUBLIC)
PHP_ME(HttpCookie, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie___toString, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
php_http_header_parser_t ctx;
php_http_buffer_t buf;
php_http_header_parser_state_t rs;
-
+
if (!php_http_buffer_from_string_ex(&buf, header, length)) {
php_error_docref(NULL, E_WARNING, "Could not allocate buffer");
return FAILURE;
}
-
+
if (!php_http_header_parser_init(&ctx)) {
php_http_buffer_dtor(&buf);
php_error_docref(NULL, E_WARNING, "Could not initialize header parser");
return FAILURE;
}
-
+
rs = php_http_header_parser_parse(&ctx, &buf, PHP_HTTP_HEADER_PARSER_CLEANUP, headers, callback_func, callback_data);
php_http_header_parser_dtor(&ctx);
php_http_buffer_dtor(&buf);
PHP_METHOD(HttpHeader, getParams)
{
zval value_tmp, zctor, zparams_obj, *zargs = NULL;
-
+
ZVAL_STRINGL(&zctor, "__construct", lenof("__construct"));
-
+
object_init_ex(&zparams_obj, php_http_params_get_class_entry());
-
+
zargs = (zval *) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval));
ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp));
if (ZEND_NUM_ARGS()) {
zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]);
}
-
+
if (SUCCESS == call_user_function(NULL, &zparams_obj, &zctor, return_value, ZEND_NUM_ARGS()+1, zargs)) {
RETVAL_ZVAL(&zparams_obj, 0, 1);
}
-
+
zval_ptr_dtor(&zctor);
if (zargs) {
efree(zargs);
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_header_methods[] = {
PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, __unserialize, ai_HttpHeader___unserialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, __serialize, ai_HttpHeader___serialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, match, ai_HttpHeader_match, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, negotiate, ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC)
PHP_ME(HttpHeader, getParams, ai_HttpHeader_getParams, ZEND_ACC_PUBLIC)
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-
RETVAL_OBJECT(&obj->parent->zo, 1);
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0)
-ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toString, 0, 0, 0)
ZEND_ARG_INFO(0, include_parent)
ZEND_END_ARG_INFO();
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_message_methods[] = {
PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessage, getBody, ai_HttpMessage_getBody, ZEND_ACC_PUBLIC)
}
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody___toString, 0, 0, 0)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_serialize, 0, 0, 0)
ZEND_END_ARG_INFO();
-PHP_METHOD(HttpMessageBody, __toString)
+PHP_METHOD(HttpMessageBody, serialize)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_message_body_methods[] = {
PHP_ME(HttpMessageBody, __construct, ai_HttpMessageBody___construct, ZEND_ACC_PUBLIC)
- PHP_ME(HttpMessageBody, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
- PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
- PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, serialize, ai_HttpMessageBody_serialize, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, toString, serialize, ai_HttpMessageBody_serialize, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, __toString, serialize, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, unserialize, ai_HttpMessageBody_unserialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, __serialize, ai_HttpMessageBody___serialize, ZEND_ACC_PUBLIC)
PHP_ME(HttpMessageBody, __unserialize,ai_HttpMessageBody___unserialize,ZEND_ACC_PUBLIC)
}
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_params_methods[] = {
PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(HttpParams, toArray, ai_HttpParams_toArray, ZEND_ACC_PUBLIC)
PHP_ME(HttpParams, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpParams, offsetExists, ai_HttpParams_offsetExists, ZEND_ACC_PUBLIC)
PHP_ME(HttpParams, offsetUnset, ai_HttpParams_offsetUnset, ZEND_ACC_PUBLIC)
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-
zval *entry;
zend_string *xkey, *xstr;
php_http_arrkey_t key;
-
+
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(src), key.h, key.key, entry)
{
if (key.key) {
return FAILURE;
}
}
-
+
if (Z_TYPE_P(entry) == IS_STRING) {
if (PHP_ICONV_ERR_SUCCESS != php_iconv_string(Z_STRVAL_P(entry), Z_STRLEN_P(entry), &xstr, oe, ie)) {
if (key.key) {
}
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
zval subarray;
-
+
array_init(&subarray);
if (key.key) {
add_assoc_zval_ex(dst, xkey->val, xkey->len, &subarray);
return FAILURE;
}
}
-
+
if (key.key) {
zend_string_release(xkey);
}
{
zval *params = NULL;
zend_error_handling zeh;
-
+
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z", ¶ms), invalid_arg, return);
zend_replace_error_handling(EH_THROW, php_http_get_exception_bad_querystring_class_entry(), &zeh);
zend_long type = 0;
zend_bool del = 0;
zval *ztype = NULL, *defval = NULL;
-
+
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|szzb", &name_str, &name_len, &ztype, &defval, &del)) {
if (name_str && name_len) {
if (ztype) {
type = Z_LVAL_P(ztype);
} else if(Z_TYPE_P(ztype) == IS_STRING) {
switch (Z_STRVAL_P(ztype)[0]) {
- case 'B':
+ case 'B':
case 'b': type = PHP_HTTP_QUERYSTRING_TYPE_BOOL; break;
case 'L':
case 'l':
case 'd':
case 'D':
case 'F':
- case 'f': type = PHP_HTTP_QUERYSTRING_TYPE_FLOAT; break;
+ case 'f': type = PHP_HTTP_QUERYSTRING_TYPE_FLOAT; break;
case 'S':
case 's': type = PHP_HTTP_QUERYSTRING_TYPE_STRING; break;
case 'A':
PHP_METHOD(HttpQueryString, set)
{
zval *params;
-
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", ¶ms)) {
return;
}
-
+
php_http_querystring_set(getThis(), params, QS_MERGE);
RETVAL_ZVAL(getThis(), 1, 0);
}
zend_error_handling zeh;
php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", ¶ms), invalid_arg, return);
-
+
zend_replace_error_handling(EH_THROW, php_http_get_exception_bad_querystring_class_entry(), &zeh);
ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(Z_OBJ_P(instance)));
/* make sure we do not inherit the reference to _GET */
php_http_querystring_set(getThis(), &na, 0);
RETVAL_ZVAL(getThis(), 1, 0);
-
+
zval_ptr_dtor(&na);
}
#endif /* HAVE_ICONV */
PHP_METHOD(HttpQueryString, unserialize)
{
zval *serialized;
-
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", &serialized)) {
return;
}
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
return;
}
-
+
qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp);
ZVAL_DEREF(qa);
{
zend_string *offset;
zval *value, param, znull;
-
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &offset, &value)) {
return;
}
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
return;
}
-
+
qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp);
ZVAL_DEREF(qa);
{
zend_string *offset;
zval param, znull;
-
+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
return;
}
zval_ptr_dtor(¶m);
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_querystring_methods[] = {
PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(HttpQueryString, toArray, ai_HttpQueryString_toArray, ZEND_ACC_PUBLIC)
PHP_ME(HttpQueryString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpQueryString, get, ai_HttpQueryString_get, ZEND_ACC_PUBLIC)
PHP_ME(HttpQueryString, set, ai_HttpQueryString_set, ZEND_ACC_PUBLIC)
php_http_url_free(&purl);
}
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpUrl___toString, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO();
+
static zend_function_entry php_http_url_methods[] = {
PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC)
PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC)
PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl___toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpUrl, toArray, ai_HttpUrl_toArray, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
-