Commits

Ruslan Osmanov committed a7cb550 Merge

Merged in remicollet/pecl-event/bug65847 (pull request #3)

Fix pec bug #65847, evhttp_connection_get_bufferevent in libevent >= 2.0.17

Comments (0)

Files changed (4)

classes/http_connection.c

 	zval                     *zbase;
 	php_event_base_t         *b;
 	zval                     *zdns_base   = NULL;
-	php_event_dns_base_t     *dnsb;
+	php_event_dns_base_t     *dnsb = NULL;
 	char                     *address;
 	int                       address_len;
 	long                      port;

classes/http_request.c

 }
 /* }}} */
 
+#if LIBEVENT_VERSION_NUMBER >= 0x02001100
 /* {{{ proto EventBufferEvent EventHttpRequest::getBufferEvent(void);
  * Returns EventBufferEvent object on success, otherwise &null. */
 PHP_METHOD(EventHttpRequest, getBufferEvent)
 	bev->_internal = 1;
 }
 /* }}} */
+#endif
 
 /* {{{ proto EventHttpConnection EventHttpRequest::getConnection(void);
  * Returns EventHttpConnection object. 
 	if (zbuf) {
 		PHP_EVENT_FETCH_BUFFER(b, zbuf);
 		PHP_EVENT_ASSERT(b->buf);
+		evhttp_send_reply_chunk(http_req->ptr, b->buf);
 	}
-
-	evhttp_send_reply_chunk(http_req->ptr, b->buf);
 }
 /* }}} */
 
 	PHP_ME(EventHttpRequest, clearHeaders,     arginfo_event__void,                     ZEND_ACC_PUBLIC)
 	PHP_ME(EventHttpRequest, removeHeader,     arginfo_event_http_req_remove_header,    ZEND_ACC_PUBLIC)
 	PHP_ME(EventHttpRequest, findHeader,       arginfo_event_http_req_remove_header,    ZEND_ACC_PUBLIC)
+#if LIBEVENT_VERSION_NUMBER >= 0x02001100
 	PHP_ME(EventHttpRequest, getBufferEvent,   arginfo_event__void,                     ZEND_ACC_PUBLIC)
+#endif
 	PHP_ME(EventHttpRequest, getConnection,    arginfo_event__void,                     ZEND_ACC_PUBLIC)
 	PHP_ME(EventHttpRequest, closeConnection,  arginfo_event__void,                     ZEND_ACC_PUBLIC)
 
 PHP_METHOD(EventHttpRequest, clearHeaders);
 PHP_METHOD(EventHttpRequest, removeHeader);
 PHP_METHOD(EventHttpRequest, findHeader);
+#if LIBEVENT_VERSION_NUMBER >= 0x02001100
 PHP_METHOD(EventHttpRequest, getBufferEvent);
+#endif
 PHP_METHOD(EventHttpRequest, getConnection);
 PHP_METHOD(EventHttpRequest, closeConnection);