X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=d943b0df01e3d6afbdae98a407c79267e48a530f;hp=5bf39207c4ee7ce10630ddc1f8452c5cc9902679;hb=e47ee304be6758fbbfd238476f8a6bda9090fe12;hpb=4f8c51464143f79fd4367c386e5108361ce83a42 diff --git a/http_api.c b/http_api.c index 5bf3920..d943b0d 100644 --- a/http_api.c +++ b/http_api.c @@ -24,6 +24,8 @@ #include "php.h" #include "ext/standard/url.h" +#include "SAPI.h" + #include "php_http.h" #include "php_http_std_defs.h" #include "php_http_api.h" @@ -226,6 +228,20 @@ PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zen } /* }}} */ +/* {{{ zend_bool http_get_request_body(char **, size_t *) */ +PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_bool dup TSRMLS_DC) +{ + *length = 0; + *body = NULL; + + if (SG(request_info).raw_post_data) { + *length = SG(request_info).raw_post_data_length; + *body = (char *) (dup ? estrndup(SG(request_info).raw_post_data, *length) : SG(request_info).raw_post_data); + return SUCCESS; + } + return FAILURE; +} +/* }}} */ /* {{{ char *http_chunked_decode(char *, size_t, char **, size_t *) */ PHP_HTTP_API const char *_http_chunked_decode(const char *encoded, size_t encoded_len,