X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_message_api.c;h=86ab323366facbdf8383d2123ca6ce87a3b41be1;hp=7f22d17095d1a5afb90da96969edc411914e2e73;hb=3e696a1c24d6ffc382567876eafa2a5bd9b8afa7;hpb=4f5d70d375dac27459a80c1e5271697c1f46c675 diff --git a/http_message_api.c b/http_message_api.c index 7f22d17..86ab323 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -18,8 +18,8 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif - #include "php.h" + #include "php_http.h" #include "php_http_std_defs.h" #include "php_http_api.h" @@ -59,14 +59,14 @@ static void _http_message_headers_cb(const char *http_line, HashTable **headers, // response if (!strncmp(http_line, "HTTP/1.", lenof("HTTP/1."))) { new->type = HTTP_MSG_RESPONSE; - new->info.response.http_version = (float) atof(http_line + lenof("HTTP/")); + new->info.response.http_version = atof(http_line + lenof("HTTP/")); new->info.response.code = atoi(http_line + lenof("HTTP/1.1 ")); } else // request if (!strncmp(http_line + line_length - lenof("HTTP/1.1"), "HTTP/1.", lenof("HTTP/1."))) { const char *method_sep_uri = strchr(http_line, ' '); new->type = HTTP_MSG_REQUEST; - new->info.request.http_version = (float) atof(http_line + line_length - lenof("1.1")); + new->info.request.http_version = atof(http_line + line_length - lenof("1.1")); new->info.request.method = estrndup(http_line, method_sep_uri - http_line); new->info.request.URI = estrndup(method_sep_uri + 1, http_line + line_length - method_sep_uri - 1 - lenof(" HTTP/1.1")); } @@ -190,7 +190,7 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char zval *len; char *tmp; - spprintf(&tmp, 0, "%lu", decoded_len); + spprintf(&tmp, 0, "%lu", (ulong) decoded_len); MAKE_STD_ZVAL(len); ZVAL_STRING(len, tmp, 0); @@ -213,8 +213,10 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char } else /* no headers that indicate content length */ - if (1) { + if (HTTP_MSG_TYPE(RESPONSE, msg)) { phpstr_from_string_ex(PHPSTR(msg), body, message + message_length - body); + } else { + continue_at = body; } /* check for following messages */