Fix win32 compile on php4
[m6w6/ext-http] / http_api.c
index f9091ee4791694d68aefcea20b564770907b75de..0e73eb3682594c2533358181624c385726009f81 100644 (file)
@@ -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, <daniel@haxx.se>, 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);
 }
 /* }}} */