Commits

rickysu  committed 6e2cc79

add EventHttpRequest::getEventHttpConnection(void)

  • Participants
  • Parent commits fc76f68

Comments (0)

Files changed (3)

File classes/http_request.c

 }
 /* }}} */
 
+/* {{{ proto EventHttpConnection EventHttpRequest::getEventHttpConnection(void);
+ * Returns EventHttpConnection object. */
+PHP_METHOD(EventHttpRequest, getEventHttpConnection)
+{
+	php_event_http_req_t *http_req;
+        struct evhttp_connection *conn;
+        php_event_http_conn_t    *evcon;
+
+	if (zend_parse_parameters_none() == FAILURE) {
+		return;
+	}
+
+	PHP_EVENT_FETCH_HTTP_REQ(http_req, getThis());
+
+	_check_http_req_ptr(http_req);
+
+	PHP_EVENT_INIT_CLASS_OBJECT(return_value, php_event_http_conn_ce);
+        PHP_EVENT_FETCH_HTTP_CONN(evcon, return_value);
+	conn = evhttp_request_get_connection(http_req->ptr);
+	evcon->conn = conn;
+	evcon->base = NULL;
+        evcon->dns_base = NULL;
+	Z_ADDREF_P(return_value);
+}
+/* }}} */
+
 
 
 /* {{{ proto void EventHttpRequest::sendError(int error[, string reason = NULL]);
 ZEND_END_ARG_INFO();
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_evbuffer_add, 0, 0, 1)
-	ZEND_ARG_INFO(0, data) 
+	ZEND_ARG_INFO(0, data)
 ZEND_END_ARG_INFO();
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_evbuffer_add_buffer, 0, 0, 1)
 	PHP_MALIAS(Event, delTimer,  del, arginfo_event__void, ZEND_ACC_PUBLIC)
 	PHP_MALIAS(Event, addSignal, add, arginfo_event_add,   ZEND_ACC_PUBLIC)
 	PHP_MALIAS(Event, delSignal, del, arginfo_event__void, ZEND_ACC_PUBLIC)
-													  
+
 	PHP_FE_END
 };
 /* }}} */
 #if LIBEVENT_VERSION_NUMBER >= 0x02010200
 	PHP_ME(EventBase, resume,             arginfo_event__void,              ZEND_ACC_PUBLIC)
 #endif
-														   
+
 	PHP_FE_END
 };
 /* }}} */
 	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)
 	PHP_ME(EventHttpRequest, getEventBufferEvent,   arginfo_event__void,                ZEND_ACC_PUBLIC)
+        PHP_ME(EventHttpRequest, getEventHttpConnection,   arginfo_event__void,                ZEND_ACC_PUBLIC)
 
 	PHP_FE_END
 };
 PHP_METHOD(EventHttpRequest, removeHeader);
 PHP_METHOD(EventHttpRequest, findHeader);
 PHP_METHOD(EventHttpRequest, getEventBufferEvent);
+PHP_METHOD(EventHttpRequest, getEventHttpConnection);
 
 /* Extra API END }}} */
 #endif
 
 #endif /* PHP_EVENT_FE_H */
 
-/* 
+/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4