From: Michael Wallner Date: Wed, 24 Aug 2005 08:54:30 +0000 (+0000) Subject: - ditch left-overs of yesterday's commit X-Git-Tag: RELEASE_0_12_0~23 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=94e87723fd916f0fe9e72f2280433b06e295bf79;p=m6w6%2Fext-http - ditch left-overs of yesterday's commit - use http_locate_body() in http_message_parse() --- diff --git a/http_api.c b/http_api.c index 654bf88..d0f91c6 100644 --- a/http_api.c +++ b/http_api.c @@ -340,10 +340,6 @@ PHP_HTTP_API const char *_http_chunked_decode(const char *encoded, size_t encode } /* }}} */ -/* {{{ STATUS http_locate_body(char *, size_t) */ -PHP_HTTP_API -/* }}} */ - /* * Local variables: * tab-width: 4 diff --git a/http_headers_api.c b/http_headers_api.c index 5048266..b2a2081 100644 --- a/http_headers_api.c +++ b/http_headers_api.c @@ -255,15 +255,6 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header Z_ARRVAL(array) = headers; header_len = body ? body - header : strlen(header) + 1; - -/* - if (header_len < 2 || ((!lflf) && (!crlfcrlf) && (!strchr(header, ':')))) { - fprintf(stderr, "header_len: %lu, lflf: %p, crlfcrlf: %p, ':': %p\n(%s)\n", - header_len, lflf, crlfcrlf, strchr(header, ':'), header); - http_error(HE_WARNING, HTTP_E_MALFORMED_HEADERS, "Cannot parse too short or malformed HTTP headers"); - return FAILURE; - } -*/ line = header; while (header_len >= (size_t) (line - begin)) { @@ -290,16 +281,6 @@ PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header Z_ARRVAL(array) = headers; } else - /* - if ( (!strncmp(header, "HTTP/1.", lenof("HTTP/1."))) || - (!strncmp(line - lenof("HTTP/1.x" HTTP_CRLF) + value_len, "HTTP/1.", lenof("HTTP/1.")))) { - if (func) { - func(header, &headers, callback_data TSRMLS_CC); - Z_ARRVAL(array) = headers; - } - } else - */ - /* "header: value" pair */ if (colon) { diff --git a/http_message_api.c b/http_message_api.c index 42bae1a..5a2bdb7 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -129,7 +129,7 @@ PHP_HTTP_API void _http_message_set_type(http_message *message, http_message_typ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char *message, size_t message_length TSRMLS_DC) { - char *body = NULL, *cr, *lf; + const char *body = NULL; zend_bool free_msg = msg ? 0 : 1; if ((!message) || (message_length < HTTP_MSG_MIN_SIZE)) { @@ -146,11 +146,10 @@ PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char } /* header parsing stops at (CR)LF (CR)LF */ - if (body = strstr(message, HTTP_CRLF HTTP_CRLF)) { + if (body = http_locate_body(message)) { zval *c; const char *continue_at = NULL; - body += lenof(HTTP_CRLF HTTP_CRLF); /* message has content-length header */ if (c = http_message_header(msg, "Content-Length")) { long len = atol(Z_STRVAL_P(c));