X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_api.c;h=0e73eb3682594c2533358181624c385726009f81;hb=405c97a03c1949e59a154520d2cc24a297aa6ea1;hp=f9091ee4791694d68aefcea20b564770907b75de;hpb=d9a5eb7f270247c44f4ff78c1f5d03d520e8fec0;p=m6w6%2Fext-http diff --git a/http_api.c b/http_api.c index f9091ee..0e73eb3 100644 --- a/http_api.c +++ b/http_api.c @@ -763,6 +763,9 @@ static inline void _http_curl_getinfo(CURL *ch, HashTable *info TSRMLS_DC) } /* }}} */ +#endif +/* }}} HAVE_CURL */ + /* {{{ Day/Month/TZ checks for http_parse_date() Originally by libcurl, Copyright (C) 1998 - 2004, Daniel Stenberg, , et al. */ static int check_day(char *day, size_t len) @@ -808,9 +811,6 @@ static int check_tzone(char *tzone) } /* }}} */ -#endif -/* }}} HAVE_CURL */ - /* }}} internals */ /* {{{ public API */ @@ -1744,7 +1744,8 @@ PHP_HTTP_API STATUS _http_parse_headers(char *header, int header_len, zval *arra case '\n': if (colon && (*line != ' ') && (*line != '\t')) { char *key = estrndup(header, colon - header); - add_assoc_stringl(array, key, colon + 2, line - colon - 4, 1); + while (isspace(*(++colon))); + add_assoc_stringl(array, key, colon, line - colon - 2, 1); efree(key); colon = NULL; @@ -1891,12 +1892,12 @@ PHP_HTTP_API STATUS _http_post_array(const char *URL, HashTable *postarray, #endif /* }}} HAVE_CURL */ -/* {{{ void http_auth_header(char *, char*) */ -PHP_HTTP_API void _http_auth_header(const char *type, const char *realm TSRMLS_DC) +/* {{{ STATUS http_auth_header(char *, char*) */ +PHP_HTTP_API STATUS _http_auth_header(const char *type, const char *realm TSRMLS_DC) { - char realm_header[1024]; - snprintf(realm_header, 1024, "WWW-Authenticate: %s realm=\"%s\"", type, realm); - http_send_status_header(401, realm_header); + char realm_header[1024] = {0}; + snprintf(realm_header, 1023, "WWW-Authenticate: %s realm=\"%s\"", type, realm); + return http_send_status_header(401, realm_header); } /* }}} */