* added HTTPi_Request::getResponseCode()
[m6w6/ext-http] / http_api.c
index aee6785705e884759fde2c9ed3a975f8b706e4d1..2161d6d571d14f2807c022450122e174a0971e98 100644 (file)
@@ -933,7 +933,7 @@ PHP_HTTP_API char *_http_absolute_uri_ex(
 #ifdef ZEND_ENGINE_2
                if (se = getservbyname(furl.scheme, "tcp")) {
                        furl.port = ntohs(se->s_port);
 #ifdef ZEND_ENGINE_2
                if (se = getservbyname(furl.scheme, "tcp")) {
                        furl.port = ntohs(se->s_port);
-               } else 
+               } else
 #endif
                furl.port = 80;
        } else {
 #endif
                furl.port = 80;
        } else {
@@ -1469,11 +1469,11 @@ PHP_HTTP_API STATUS _http_split_response_ex(char *response,
                }
        }
 
                }
        }
 
-       if (*body && (*body_len = response_len - (*body - header))) {
-               *body = estrndup(*body, *body_len - 1);
+       if (*body && (*body_len = (response_len - (*body - header)))) {
+               *body = estrndup(*body, *body_len);
        }
 
        }
 
-       return http_parse_headers_ex(header, *body ? *body - header : response_len, headers, 1);
+       return http_parse_headers_ex(header, *body ? response_len - *body_len : response_len, headers, 1);
 }
 /* }}} */
 
 }
 /* }}} */