- ditch left-overs of yesterday's commit
authorMichael Wallner <mike@php.net>
Wed, 24 Aug 2005 08:54:30 +0000 (08:54 +0000)
committerMichael Wallner <mike@php.net>
Wed, 24 Aug 2005 08:54:30 +0000 (08:54 +0000)
- use http_locate_body() in http_message_parse()

http_api.c
http_headers_api.c
http_message_api.c

index 654bf884670436f9d37ba75c6e2e0eb76422634c..d0f91c695db82d3176fe73525c80f5f1c3784a36 100644 (file)
@@ -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
index 5048266a8fddd949d3035295fb601cd71e5634fe..b2a2081e18ae79bd5cf8a1c601befd238972a08f 100644 (file)
@@ -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) {
 
index 42bae1a79f247e3c01c719d07faf5aa97b5fca34..5a2bdb763670023e5769d16f838bd598822964d0 100644 (file)
@@ -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));