// HTTP_URI_MAXLEN+1 long char *
if (!(request_uri = http_absolute_uri_ex(Z_STRVAL_P(URL), Z_STRLEN_P(URL), NULL, 0, NULL, 0, 0))) {
return FAILURE;
}
// HTTP_URI_MAXLEN+1 long char *
if (!(request_uri = http_absolute_uri_ex(Z_STRVAL_P(URL), Z_STRLEN_P(URL), NULL, 0, NULL, 0, 0))) {
return FAILURE;
}
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), "headers", sizeof("headers"), (void **) &headers)) {
zval **ct_header;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), "headers", sizeof("headers"), (void **) &headers)) {
zval **ct_header;
/* only override if not already set */
if (SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header)) {
add_assoc_stringl(*headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1);
/* only override if not already set */
if (SUCCESS != zend_hash_find(Z_ARRVAL_PP(headers), "Content-Type", sizeof("Content-Type"), (void **) &ct_header)) {
add_assoc_stringl(*headers, "Content-Type", Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1);
if (Z_STRLEN_P(qdata) && (strlen(request_uri) < HTTP_URI_MAXLEN)) {
if (!strchr(request_uri, '?')) {
if (Z_STRLEN_P(qdata) && (strlen(request_uri) < HTTP_URI_MAXLEN)) {
if (!strchr(request_uri, '?')) {
- *resp = GET_PROP(obj, responseData),
- *info = GET_PROP(obj, responseInfo),
- *hist = GET_PROP(obj, recordHistory);
+ *resp = convert_to_type(IS_ARRAY, GET_PROP(obj, responseData)),
+ *info = convert_to_type(IS_ARRAY, GET_PROP(obj, responseInfo));
- /* should we record history? */
- if (Z_TYPE_P(hist) != IS_BOOL) {
- convert_to_boolean(hist);
- }
- if (Z_LVAL_P(hist)) {
+ if (zval_is_true(GET_PROP(obj, recordHistory))) {
/* we need to act like a zipper, as we'll receive
* the requests and the responses in separate chains
* for redirects
/* we need to act like a zipper, as we'll receive
* the requests and the responses in separate chains
* for redirects
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), key, len, (void **) &options)) {
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), key, len, (void **) &options)) {
array_init(return_value);
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), key, len, (void **) &options)) {
array_init(return_value);
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), key, len, (void **) &options)) {
if (!strcmp(key, "headers")) {
zval **headers;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "headers", sizeof("headers"), (void **) &headers)) {
if (!strcmp(key, "headers")) {
zval **headers;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "headers", sizeof("headers"), (void **) &headers)) {
array_merge(*opt, *headers);
continue;
}
} else if (!strcmp(key, "cookies")) {
zval **cookies;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "cookies", sizeof("cookies"), (void **) &cookies)) {
array_merge(*opt, *headers);
continue;
}
} else if (!strcmp(key, "cookies")) {
zval **cookies;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "cookies", sizeof("cookies"), (void **) &cookies)) {
array_merge(*opt, *cookies);
continue;
}
} else if (!strcmp(key, "ssl")) {
zval **ssl;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "ssl", sizeof("ssl"), (void **) &ssl)) {
array_merge(*opt, *cookies);
continue;
}
} else if (!strcmp(key, "ssl")) {
zval **ssl;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(old_opts), "ssl", sizeof("ssl"), (void **) &ssl)) {
array_init(return_value);
array_copy(opts, return_value);
}
array_init(return_value);
array_copy(opts, return_value);
}
- URL = GET_PROP(obj, url);
- RETURN_STRINGL(Z_STRVAL_P(URL), Z_STRLEN_P(URL), 1);
+ RETURN_ZVAL(URL, 1, 0);
-
- meth = GET_PROP(obj, method);
- RETURN_LONG(Z_LVAL_P(meth));
+ zval *meth = GET_PROP(obj, method);
+
+ RETURN_ZVAL(meth, 1, 0);
-
- ctype = GET_PROP(obj, contentType);
- RETURN_STRINGL(Z_STRVAL_P(ctype), Z_STRLEN_P(ctype), 1);
+ zval *ctype = GET_PROP(obj, contentType);
+
+ RETURN_ZVAL(ctype, 1, 0);
UPD_PROP(obj, string, queryData, query_data);
efree(query_data);
} else {
UPD_PROP(obj, string, queryData, query_data);
efree(query_data);
} else {
UPD_STRL(obj, queryData, Z_STRVAL_P(qdata), Z_STRLEN_P(qdata));
}
RETURN_TRUE;
UPD_STRL(obj, queryData, Z_STRVAL_P(qdata), Z_STRLEN_P(qdata));
}
RETURN_TRUE;
-
- qdata = GET_PROP(obj, queryData);
- RETURN_STRINGL(Z_STRVAL_P(qdata), Z_STRLEN_P(qdata), 1);
+ zval *qdata = convert_to_type_ex(IS_STRING, GET_PROP(obj, queryData));
+
+ RETURN_ZVAL(qdata, 1, 0);
if (SUCCESS != http_urlencode_hash_ex(HASH_OF(qdata), 1, Z_STRVAL_P(old_qdata), Z_STRLEN_P(old_qdata), &query_data, &query_data_len)) {
RETURN_FALSE;
if (SUCCESS != http_urlencode_hash_ex(HASH_OF(qdata), 1, Z_STRVAL_P(old_qdata), Z_STRLEN_P(old_qdata), &query_data, &query_data_len)) {
RETURN_FALSE;
array_init(return_value);
array_copy(post_data, return_value);
}
array_init(return_value);
array_copy(post_data, return_value);
}
add_assoc_stringl(entry, "type", type, type_len, 1);
add_assoc_stringl(entry, "file", file, file_len, 1);
add_assoc_stringl(entry, "type", type, type_len, 1);
add_assoc_stringl(entry, "file", file, file_len, 1);
array_init(return_value);
array_copy(files, return_value);
array_init(return_value);
array_copy(files, return_value);
-
- putfile = GET_PROP(obj, putFile);
- RETVAL_STRINGL(Z_STRVAL_P(putfile), Z_STRLEN_P(putfile), 1);
+ zval *putfile = convert_to_type_ex(IS_STRING, GET_PROP(obj, putFile));
+
+ RETURN_ZVAL(putfile, 1, 0);
array_init(return_value);
array_copy(data, return_value);
}
array_init(return_value);
array_copy(data, return_value);
}
if (SUCCESS != zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &headers)) {
RETURN_FALSE;
}
if (SUCCESS != zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &headers)) {
RETURN_FALSE;
}
if (!header_len || !header_name) {
array_init(return_value);
array_copy(*headers, return_value);
} else if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(headers), pretty_key(header_name, header_len, 1, 1), header_len + 1, (void **) &header)) {
if (!header_len || !header_name) {
array_init(return_value);
array_copy(*headers, return_value);
} else if (SUCCESS == zend_hash_find(Z_ARRVAL_PP(headers), pretty_key(header_name, header_len, 1, 1), header_len + 1, (void **) &header)) {
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &headers)) {
ulong idx = 0;
char *key = NULL;
zval **header = NULL;
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &headers)) {
ulong idx = 0;
char *key = NULL;
zval **header = NULL;
FOREACH_HASH_KEYVAL(Z_ARRVAL_PP(headers), key, idx, header) {
if (key && !strcasecmp(key, "Set-Cookie")) {
/* several cookies? */
FOREACH_HASH_KEYVAL(Z_ARRVAL_PP(headers), key, idx, header) {
if (key && !strcasecmp(key, "Set-Cookie")) {
/* several cookies? */
if (SUCCESS == http_parse_cookie(Z_STRVAL_PP(header), Z_ARRVAL_P(cookie_hash))) {
if (!cookie_len) {
add_next_index_zval(return_value, cookie_hash);
if (SUCCESS == http_parse_cookie(Z_STRVAL_PP(header), Z_ARRVAL_P(cookie_hash))) {
if (!cookie_len) {
add_next_index_zval(return_value, cookie_hash);
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "body", sizeof("body"), (void **) &body)) {
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "body", sizeof("body"), (void **) &body)) {
- RETURN_STRINGL(Z_STRVAL_PP(body), Z_STRLEN_PP(body), 1);
+ convert_to_string_ex(body);
+ RETURN_ZVAL(*body, 1, 0);
-
- code = GET_PROP(obj, responseCode);
- RETURN_LONG(Z_LVAL_P(code));
+ zval *code = convert_to_type_ex(IS_LONG, GET_PROP(obj, responseCode));
+
+ RETURN_ZVAL(code, 1, 0);
if (info_len && info_name) {
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(info), pretty_key(info_name, info_len, 0, 0), info_len + 1, (void **) &infop)) {
if (info_len && info_name) {
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(info), pretty_key(info_name, info_len, 0, 0), info_len + 1, (void **) &infop)) {