projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- fix dep on SPL in PHP-5.1
[m6w6/ext-http]
/
http_message_api.c
diff --git
a/http_message_api.c
b/http_message_api.c
index 6dd20673b081addab2c92fa72902d6cfa93b7ce1..d175201913996af652c287015b218d1de52c1842 100644
(file)
--- a/
http_message_api.c
+++ b/
http_message_api.c
@@
-160,7
+160,7
@@
PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char
char *tmp;
int tmp_len;
char *tmp;
int tmp_len;
- tmp_len = (int) spprintf(&tmp, 0, "%
lu", (ulong)
decoded_len);
+ tmp_len = (int) spprintf(&tmp, 0, "%
zu",
decoded_len);
MAKE_STD_ZVAL(len);
ZVAL_STRINGL(len, tmp, tmp_len, 0);
MAKE_STD_ZVAL(len);
ZVAL_STRINGL(len, tmp, tmp_len, 0);
@@
-188,7
+188,8
@@
PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char
if (c = http_message_header(msg, "Content-Range")) {
ulong total = 0, start = 0, end = 0, len = 0;
if (c = http_message_header(msg, "Content-Range")) {
ulong total = 0, start = 0, end = 0, len = 0;
- if (!strncasecmp(Z_STRVAL_P(c), "bytes=", lenof("bytes="))) {
+ if (!strncasecmp(Z_STRVAL_P(c), "bytes", lenof("bytes")) &&
+ (Z_STRVAL_P(c)[lenof("bytes")] == '=' || Z_STRVAL_P(c)[lenof("bytes")] == ' ')) {
char *total_at = NULL, *end_at = NULL;
char *start_at = Z_STRVAL_P(c) + lenof("bytes=");
char *total_at = NULL, *end_at = NULL;
char *start_at = Z_STRVAL_P(c) + lenof("bytes=");
@@
-259,12
+260,12
@@
PHP_HTTP_API http_message *_http_message_parse_ex(http_message *msg, const char
# endif /* HTTP_HAVE_ZLIB */
}
# endif /* HTTP_HAVE_ZLIB */
}
- if (decoded
&& decoded_len
) {
+ if (decoded) {
zval *len;
char *tmp;
int tmp_len;
zval *len;
char *tmp;
int tmp_len;
- tmp_len = (int) spprintf(&tmp, 0, "%
lu", (ulong)
decoded_len);
+ tmp_len = (int) spprintf(&tmp, 0, "%
zu",
decoded_len);
MAKE_STD_ZVAL(len);
ZVAL_STRINGL(len, tmp, tmp_len, 0);
MAKE_STD_ZVAL(len);
ZVAL_STRINGL(len, tmp, tmp_len, 0);
@@
-305,6
+306,7
@@
PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
char *key, *data;
ulong idx;
zval **header;
char *key, *data;
ulong idx;
zval **header;
+ HashPosition pos1;
phpstr_init_ex(&str, 4096, 0);
phpstr_init_ex(&str, 4096, 0);
@@
-330,7
+332,7
@@
PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
break;
}
break;
}
- FOREACH_HASH_KEYVAL(&msg->hdrs, key, idx, header) {
+ FOREACH_HASH_KEYVAL(
pos1,
&msg->hdrs, key, idx, header) {
if (key) {
zval **single_header;
if (key) {
zval **single_header;
@@
-341,9
+343,12
@@
PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
break;
case IS_ARRAY:
break;
case IS_ARRAY:
- FOREACH_VAL(*header, single_header) {
+ {
+ HashPosition pos2;
+ FOREACH_VAL(pos2, *header, single_header) {
phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(single_header));
}
phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(single_header));
}
+ }
break;
}
break;
}
@@
-443,14
+448,16
@@
PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC)
char *key;
ulong idx;
zval **val;
char *key;
ulong idx;
zval **val;
+ HashPosition pos1;
- FOREACH_HASH_KEYVAL(&message->hdrs, key, idx, val) {
+ FOREACH_HASH_KEYVAL(
pos1,
&message->hdrs, key, idx, val) {
if (key) {
if (Z_TYPE_PP(val) == IS_ARRAY) {
zend_bool first = 1;
zval **data;
if (key) {
if (Z_TYPE_PP(val) == IS_ARRAY) {
zend_bool first = 1;
zval **data;
+ HashPosition pos2;
- FOREACH_VAL(*val, data) {
+ FOREACH_VAL(
pos2,
*val, data) {
http_send_header_ex(key, strlen(key), Z_STRVAL_PP(data), Z_STRLEN_PP(data), first, NULL);
first = 0;
}
http_send_header_ex(key, strlen(key), Z_STRVAL_PP(data), Z_STRLEN_PP(data), first, NULL);
first = 0;
}