int vallen = 0, keylen = 0, done = 0;
zval array;
- Z_ARRVAL(array) = items;
+ INIT_ZARR(array, items);
if (!(val = strchr(list, '='))) {
return FAILURE;
size_t header_len;
zval array;
+ INIT_PZVAL(&array);
+ Z_TYPE_P(array) = IS_ARRAY;
Z_ARRVAL(array) = headers;
+
if (body) {
header_len = body - header;
} else {
while (header_len >= (size_t) (line - begin)) {
int value_len = 0;
-
+ /* note: valgrind may choke on that -- should be safe though */
switch (*line++)
{
case ':':
PHP_HTTP_API void _http_info_default_callback(void **nothing, HashTable **headers, http_info *info TSRMLS_DC)
{
zval array;
- Z_ARRVAL(array) = *headers;
+
+ INIT_ZARR(array, *headers);
switch (info->type)
{
zval strct;
zval *headers;
- Z_TYPE(strct) = IS_ARRAY;
- Z_ARRVAL(strct) = HASH_OF(obj);
+ INIT_ZARR(strct, HASH_OF(obj));
add_assoc_long(&strct, "type", msg->type);
add_assoc_double(&strct, "httpVersion", msg->http.version);
char *uri = NULL;
zval **zhost, options, headers;
+ INIT_PZVAL(&options);
+ INIT_PZVAL(&headers);
array_init(&options);
array_init(&headers);
zend_hash_copy(Z_ARRVAL(headers), &message->hdrs, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *));
zval array; \
char *m_prop_name; \
int m_prop_len; \
- Z_ARRVAL(array) = OBJ_PROP(obj); \
+ INIT_ZARR(array, OBJ_PROP(obj)); \
zend_mangle_property_name(&m_prop_name, &m_prop_len, "*", 1, name, lenof(name), 1); \
add_assoc_ ##ptype## _ex(&array, m_prop_name, sizeof(name)+4, val); \
}
zval array; \
char *m_prop_name; \
int m_prop_len; \
- Z_ARRVAL(array) = OBJ_PROP(obj); \
+ INIT_ZARR(array, OBJ_PROP(obj)); \
zend_mangle_property_name(&m_prop_name, &m_prop_len, "*", 1, name, lenof(name), 1); \
add_assoc_stringl_ex(&array, m_prop_name, sizeof(name)+4, val, len, 1); \
}
zval headers;
getObject(http_message_object, obj);
- Z_ARRVAL(headers) = &obj->message->hdrs;
+ INIT_ZARR(headers, &obj->message->hdrs);
array_init(return_value);
array_copy(&headers, return_value);
}
}
zend_hash_clean(&obj->message->hdrs);
- Z_ARRVAL(old_headers) = &obj->message->hdrs;
+ INIT_ZARR(old_headers, &obj->message->hdrs);
array_copy(new_headers, &old_headers);
}
/* }}} */
return;
}
- Z_ARRVAL(old_headers) = &obj->message->hdrs;
+ INIT_ZARR(old_headers, &obj->message->hdrs);
if (append) {
array_append(new_headers, &old_headers);
} else {
PHP_HTTP_API void _http_request_info(CURL *ch, HashTable *info TSRMLS_DC)
{
zval array;
- Z_ARRVAL(array) = info;
+ INIT_ZARR(array, info);
HTTP_CURL_INFO(EFFECTIVE_URL);
#if LIBCURL_VERSION_NUM >= 0x070a07
}
method[method_len] = '\0';
- Z_ARRVAL(array) = &HTTP_G(request).methods.custom;
+ INIT_ZARR(array, &HTTP_G(request).methods.custom);
add_next_index_stringl(&array, method, method_len, 0);
method_len = spprintf(&http_method, 0, "HTTP_METH_%s", method);
DCL_PROP(PUBLIC, bool, recordHistory, 1);
+#ifndef WONKY
/*
* Request Method Constants
*/
DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM);
DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY);
# endif /* LIBCURL_VERSION_NUM */
+#endif /* WONKY */
}
void _http_request_object_free(zend_object *object TSRMLS_DC)
DCL_STATIC_PROP(PROTECTED, long, bufferSize, HTTP_SENDBUF_SIZE);
DCL_STATIC_PROP(PROTECTED, double, throttleDelay, 0.0);
+#ifndef WONKY
DCL_CONST(long, "ETAG_MD5", HTTP_ETAG_MD5);
DCL_CONST(long, "ETAG_SHA1", HTTP_ETAG_SHA1);
-#ifdef HTTP_HAVE_MHASH
+# ifdef HTTP_HAVE_MHASH
{
int l, i, c = mhash_count();
}
}
}
-#endif
+# endif /* HTTP_HAVE_MHASH */
+#endif /* WONKY */
}
static void _http_grab_response_headers(void *data, void *arg TSRMLS_DC)
*/
PHP_METHOD(HttpResponse, send)
{
- zval *sent, *headers;
+ zval *sent;
zend_bool clean_ob = 1;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &clean_ob)) {
ZVAL_BOOL(tmp, value);
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
+
+void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC)
+{
+ zval *tmp;
+
+ ALLOC_ZVAL(tmp);
+ tmp->is_ref = 0;
+ tmp->refcount = 0;
+ ZVAL_STRINGL(tmp, value, value_len, 1);
+ zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
+}
+
#endif
/*
extern int zend_declare_property_bool(zend_class_entry *ce, char *name, int name_length, long value, int access_type TSRMLS_DC);
extern void zend_update_property_bool(zend_class_entry *scope, zval *object, char *name, int name_length, long value TSRMLS_DC);
+
+extern void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_len TSRMLS_DC);
#endif
#endif
}
#endif
+#define INIT_ZARR(zv, ht) \
+ { \
+ INIT_PZVAL(&(zv)); \
+ Z_TYPE(zv) = IS_ARRAY; \
+ Z_ARRVAL(zv) = (ht); \
+ }
+
/* return bool (v == SUCCESS) */
#define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
# endif
#endif
+#ifndef ZVAL_ZVAL
+#define ZVAL_ZVAL(z, zv, copy, dtor) { \
+ int is_ref, refcount; \
+ is_ref = (z)->is_ref; \
+ refcount = (z)->refcount; \
+ *(z) = *(zv); \
+ if (copy) { \
+ zval_copy_ctor(z); \
+ } \
+ if (dtor) { \
+ if (!copy) { \
+ ZVAL_NULL(zv); \
+ } \
+ zval_ptr_dtor(&zv); \
+ } \
+ (z)->is_ref = is_ref; \
+ (z)->refcount = refcount; \
+ }
+#endif
+#ifndef RETVAL_ZVAL
+#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
+#endif
+#ifndef RETURN_ZVAL
+#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
+#endif
#endif /* PHP_HTTP_STD_DEFS_H */