projects
/
m6w6
/
ext-http
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
81e4342
)
- a header may have an array of values
author
Michael Wallner
<mike@php.net>
Mon, 11 Apr 2005 07:12:17 +0000
(07:12 +0000)
committer
Michael Wallner
<mike@php.net>
Mon, 11 Apr 2005 07:12:17 +0000
(07:12 +0000)
http_message_api.c
patch
|
blob
|
history
diff --git
a/http_message_api.c
b/http_message_api.c
index 0a90f398729829867480207662eedd17eff96304..e9eccbff55fde8f22cdc3cbd5285d878ccb43a64 100644
(file)
--- a/
http_message_api.c
+++ b/
http_message_api.c
@@
-138,6
+138,7
@@
PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
zval **header;
phpstr_init_ex(&str, msg->len, 1);
zval **header;
phpstr_init_ex(&str, msg->len, 1);
+ str.size = 4096;
switch (msg->type)
{
switch (msg->type)
{
@@
-157,13
+158,29
@@
PHP_HTTP_API void _http_message_tostring(http_message *msg, char **string, size_
FOREACH_HASH_KEYVAL(&msg->hdrs, key, idx, header) {
if (key) {
FOREACH_HASH_KEYVAL(&msg->hdrs, key, idx, header) {
if (key) {
- phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(header));
+ switch (Z_TYPE_PP(header))
+ {
+ case IS_STRING:
+ phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(header));
+ break;
+
+ case IS_ARRAY:
+ {
+ zval **single_header;
+
+ FOREACH_VAL(*header, single_header) {
+ phpstr_appendf(&str, "%s: %s" HTTP_CRLF, key, Z_STRVAL_PP(single_header));
+ }
+ }
+ break;
+ }
+
key = NULL;
}
}
phpstr_appends(&str, HTTP_CRLF);
key = NULL;
}
}
phpstr_appends(&str, HTTP_CRLF);
- phpstr_append(&str,
msg->body.data, msg->body.used
);
+ phpstr_append(&str,
PHPSTR_VAL(msg), PHPSTR_LEN(msg)
);
phpstr_fix(&str);
data = phpstr_data(&str, string, length);
phpstr_fix(&str);
data = phpstr_data(&str, string, length);