persistent handle fixes
[m6w6/ext-http] / php_http_request.c
index d65ea5c3e57e2d4ec6404032388c976f86854f33..b22e12e3876d66bc3a6d18341b67cdfb4b2dd8ee 100644 (file)
     +--------------------------------------------------------------------+
 */
 
-#include "php_http.h"
+#include "php_http_api.h"
 
 #include <ext/spl/spl_observer.h>
-#include <ext/spl/spl_iterators.h>
-#include <Zend/zend_interfaces.h>
 
 PHP_HTTP_API php_http_request_t *php_http_request_init(php_http_request_t *h, php_http_request_ops_t *ops, php_http_resource_factory_t *rf, void *init_arg TSRMLS_DC)
 {
@@ -26,7 +24,7 @@ PHP_HTTP_API php_http_request_t *php_http_request_init(php_http_request_t *h, ph
        memset(h, 0, sizeof(*h));
 
        h->ops = ops;
-       h->rf = rf ? rf : php_http_resource_factory_init(NULL, h->ops->rsrc, NULL, NULL);
+       h->rf = rf ? rf : php_http_resource_factory_init(NULL, h->ops->rsrc, h, NULL);
        h->buffer = php_http_buffer_init(NULL);
        h->parser = php_http_message_parser_init(NULL TSRMLS_CC);
        h->message = php_http_message_init(NULL, 0 TSRMLS_CC);
@@ -54,10 +52,6 @@ PHP_HTTP_API void php_http_request_dtor(php_http_request_t *h)
 
        php_http_resource_factory_free(&h->rf);
 
-       if (h->persistent_handle_id) {
-               zval_ptr_dtor(&h->persistent_handle_id);
-       }
-
        php_http_message_parser_free(&h->parser);
        php_http_message_free(&h->message);
        php_http_buffer_free(&h->buffer);
@@ -546,6 +540,7 @@ STATUS php_http_request_object_responsehandler(php_http_request_object_t *obj, z
 static int apply_pretty_key(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
        if (hash_key->arKey && hash_key->nKeyLength > 1) {
+               /* FIXME: this seems evil */
                hash_key->h = zend_hash_func(php_http_pretty_key(hash_key->arKey, hash_key->nKeyLength - 1, 1, 0), hash_key->nKeyLength);
        }
        return ZEND_HASH_APPLY_KEEP;