X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_methods.c;h=6812d7d795af9838a4ab7959f88bb93962df924d;hp=1b2d80b786dc9c1a701fbcb66f33338e4b522d3e;hb=4a881fb37338bfeacd40c42a97f334c9faed299a;hpb=0ac32c9b8590e88a5f110cc8b3154001d5c0c089 diff --git a/http_methods.c b/http_methods.c index 1b2d80b..6812d7d 100644 --- a/http_methods.c +++ b/http_methods.c @@ -30,6 +30,10 @@ #include "php_http_send_api.h" #include "php_http_url_api.h" +#include "php_http_message_object.h" +#include "php_http_response_object.h" +#include "php_http_request_object.h" + #ifdef ZEND_ENGINE_2 /* {{{ HttpResponse */ @@ -517,6 +521,38 @@ PHP_METHOD(HttpResponse, send) /* }}} */ /* }}} */ +/* {{{ HttpMessage */ + +/* {{{ void HttpMessage::__construct([string raw_message]) */ +PHP_METHOD(HttpMessage, __construct) +{ + zval *message = NULL; + int message_len; + getObject(http_message_object, obj); + http_message *msg = obj->message; + + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/", &message)) { + return; + } + + if (message) { + SET_PROP(obj, raw, message); + } +} +/* }}} */ + +/* {{{ void HttpMessage::__destruct() */ +PHP_METHOD(HttpMessage, __destruct) +{ + getObject(http_message_object, obj); + + NO_ARGS; + +} +/* }}} */ + +/* }}} */ + #ifdef HTTP_HAVE_CURL /* {{{ HttpRequest */ @@ -1358,7 +1394,7 @@ PHP_METHOD(HttpRequest, getResponseCode) data = GET_PROP(obj, responseData); if ( (SUCCESS == zend_hash_find(Z_ARRVAL_P(data), "headers", sizeof("headers"), (void **) &hdrs)) && - (SUCCESS == zend_hash_find(Z_ARRVAL_PP(hdrs), "Status", sizeof("Status"), (void **) &code))) { + (SUCCESS == zend_hash_find(Z_ARRVAL_PP(hdrs), "Response Status", sizeof("Response Status"), (void **) &code))) { RETVAL_STRINGL(Z_STRVAL_PP(code), Z_STRLEN_PP(code), 1); convert_to_long(return_value); } else {