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)) {
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) {
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)) {
}
/* 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));