etag test & fixes; set default etag mode for temp streams to crc32(b)
[m6w6/ext-http] / php_http_request_datashare.c
index f44d5b053f5232cc2095bd7765a076458c13a02f..ce3f1a34437f1e884fd90967076ef5c40e7a79df 100644 (file)
@@ -1,8 +1,18 @@
-
-#include "php_http.h"
-
-#include <ext/standard/php_string.h>
-#include <ext/spl/spl_iterators.h>
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: http                                                       |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
+    +--------------------------------------------------------------------+
+*/
+
+#include "php_http_api.h"
+
+#include <curl/curl.h>
 
 static int php_http_request_datashare_compare_handles(void *h1, void *h2);
 
@@ -55,7 +65,7 @@ PHP_HTTP_API php_http_request_datashare_t *php_http_request_datashare_init(php_h
                TSRMLS_SET_CTX(h->ts);
        }
        h->ops = ops;
-       h->rf = rf ? rf : php_http_resource_factory_init(NULL, h->ops->rsrc, NULL, NULL TSRMLS_CC);
+       h->rf = rf ? rf : php_http_resource_factory_init(NULL, h->ops->rsrc, NULL, NULL);
 
        if (h->ops->init) {
                if (!(h = h->ops->init(h, init_arg))) {
@@ -152,11 +162,11 @@ static void detach(void *r, void *h TSRMLS_DC)
 
 PHP_HTTP_API void php_http_request_datashare_reset(php_http_request_datashare_t *h)
 {
+       TSRMLS_FETCH_FROM_CTX(h->ts);
+
        if (h->ops->reset) {
                h->ops->reset(h);
        } else if (h->ops->detach) {
-               TSRMLS_FETCH_FROM_CTX(h->ts);
-
                zend_llist_apply_with_argument(PHP_HTTP_REQUEST_DATASHARE_REQUESTS(h), detach, h TSRMLS_CC);
        }
 
@@ -237,7 +247,7 @@ void php_http_request_datashare_object_free(void *object TSRMLS_DC)
        if (!o->share->persistent) {
                php_http_request_datashare_free(&o->share);
        }
-       zend_object_std_dtor((zend_object *) o);
+       zend_object_std_dtor((zend_object *) o TSRMLS_CC);
        efree(o);
 }
 
@@ -271,7 +281,7 @@ static zval **php_http_request_datashare_object_get_prop_ptr(zval *object, zval
        zend_property_info *pi;
 
        if ((pi = zend_get_property_info(php_http_request_datashare_class_entry, member, 1 TSRMLS_CC))) {
-               return &php_http_property_proxy_init(NULL, object, member TSRMLS_CC)->myself;
+               return &php_http_property_proxy_init(NULL, object, member, NULL TSRMLS_CC)->myself;
        }
 
        return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member, literal_key TSRMLS_CC);
@@ -345,7 +355,7 @@ PHP_METHOD(HttpRequestDataShare, reset)
 
 PHP_MINIT_FUNCTION(http_request_datashare)
 {
-       PHP_HTTP_REGISTER_CLASS(http\\request, DataShare, http_request_datashare, php_http_object_class_entry, 0);
+       PHP_HTTP_REGISTER_CLASS(http\\Request, DataShare, http_request_datashare, php_http_object_class_entry, 0);
        php_http_request_datashare_class_entry->create_object = php_http_request_datashare_object_new;
        memcpy(&php_http_request_datashare_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
        php_http_request_datashare_object_handlers.clone_obj = NULL;
@@ -390,3 +400,13 @@ PHP_RSHUTDOWN_FUNCTION(http_request_datashare)
        return SUCCESS;
 }
 
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+