projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- fixed a gotcha in http_chunked_decode (-size_t is always > 0)
[m6w6/ext-http]
/
http_headers_api.c
diff --git
a/http_headers_api.c
b/http_headers_api.c
index 55be354afbc50feaf56817e64812647511b1b6ac..63c46abad58a8d23f2a9004ee568e9f7227062cd 100644
(file)
--- a/
http_headers_api.c
+++ b/
http_headers_api.c
@@
-152,11
+152,9
@@
PHP_HTTP_API HashTable *_http_negotiate_q(const char *header, HashTable *support
if (separator = strchr(Z_STRVAL_PP(entry), ';')) {
const char *ptr = separator;
if (separator = strchr(Z_STRVAL_PP(entry), ';')) {
const char *ptr = separator;
- do {
- ++ptr;
- } while ((*ptr == ' ') || (*ptr == 'q') || (*ptr == '='));
+ while (*++ptr && !isdigit(*ptr));
- quality =
strtod(ptr, NULL
);
+ quality =
atof(ptr
);
identifier = estrndup(Z_STRVAL_PP(entry), separator - Z_STRVAL_PP(entry));
} else {
quality = 1000.0 - i++;
identifier = estrndup(Z_STRVAL_PP(entry), separator - Z_STRVAL_PP(entry));
} else {
quality = 1000.0 - i++;
@@
-333,7
+331,8
@@
PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header
size_t header_len;
zval array;
size_t header_len;
zval array;
- Z_ARRVAL(array) = headers;
+ INIT_ZARR(array, headers);
+
if (body) {
header_len = body - header;
} else {
if (body) {
header_len = body - header;
} else {
@@
-343,7
+342,7
@@
PHP_HTTP_API STATUS _http_parse_headers_ex(const char *header, HashTable *header
while (header_len >= (size_t) (line - begin)) {
int value_len = 0;
while (header_len >= (size_t) (line - begin)) {
int value_len = 0;
-
+ /* note: valgrind may choke on that -- should be safe though */
switch (*line++)
{
case ':':
switch (*line++)
{
case ':':