projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0da1c0a
)
wget: strip trailing whitespace from e.g. "Content-length: 120 "
author
Matthijs van de Water
<matthijs.van.de.water@gmail.com>
Sat, 22 Aug 2009 18:19:48 +0000
(20:19 +0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Sat, 22 Aug 2009 18:19:48 +0000
(20:19 +0200)
function old new delta
wget_main 2395 2427 +32
Signed-off-by: Matthijs van de Water <matthijs.van.de.water@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/wget.c
patch
|
blob
|
history
diff --git
a/networking/wget.c
b/networking/wget.c
index 26b62cc58046a9246562d60c740a5f30f4a91341..b8cd54964e1de165b6aab76a022a192f7852a739 100644
(file)
--- a/
networking/wget.c
+++ b/
networking/wget.c
@@
-880,7
+880,14
@@
However, in real world it was observed that some web servers
*/
while ((str = gethdr(buf, sizeof(buf), sfp /*, &n*/)) != NULL) {
/* gethdr converted "FOO:" string to lowercase */
- smalluint key = index_in_strings(keywords, buf) + 1;
+ smalluint key;
+ /* strip trailing whitespace */
+ char *s = strchrnul(str, '\0') - 1;
+ while (s >= str && (*s == ' ' || *s == '\t')) {
+ *s = '\0';
+ s--;
+ }
+ key = index_in_strings(keywords, buf) + 1;
if (key == KEY_content_length) {
content_len = BB_STRTOOFF(str, NULL, 10);
if (errno || content_len < 0) {