diff options
author | Matthijs van de Water <matthijs.van.de.water@gmail.com> | 2009-08-22 20:19:48 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-08-22 20:19:48 +0200 |
commit | 0d5866624d7551b9cc994853955ff41e8d09dc51 (patch) | |
tree | 2e80d032f6b1b3d7a94fa07f586dc85e47d1a9de /networking/wget.c | |
parent | 0da1c0a73298087def5f42be61913b79fd2d9193 (diff) | |
download | busybox-w32-0d5866624d7551b9cc994853955ff41e8d09dc51.tar.gz busybox-w32-0d5866624d7551b9cc994853955ff41e8d09dc51.tar.bz2 busybox-w32-0d5866624d7551b9cc994853955ff41e8d09dc51.zip |
wget: strip trailing whitespace from e.g. "Content-length: 120 "
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>
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/networking/wget.c b/networking/wget.c index 26b62cc58..b8cd54964 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -880,7 +880,14 @@ However, in real world it was observed that some web servers | |||
880 | */ | 880 | */ |
881 | while ((str = gethdr(buf, sizeof(buf), sfp /*, &n*/)) != NULL) { | 881 | while ((str = gethdr(buf, sizeof(buf), sfp /*, &n*/)) != NULL) { |
882 | /* gethdr converted "FOO:" string to lowercase */ | 882 | /* gethdr converted "FOO:" string to lowercase */ |
883 | smalluint key = index_in_strings(keywords, buf) + 1; | 883 | smalluint key; |
884 | /* strip trailing whitespace */ | ||
885 | char *s = strchrnul(str, '\0') - 1; | ||
886 | while (s >= str && (*s == ' ' || *s == '\t')) { | ||
887 | *s = '\0'; | ||
888 | s--; | ||
889 | } | ||
890 | key = index_in_strings(keywords, buf) + 1; | ||
884 | if (key == KEY_content_length) { | 891 | if (key == KEY_content_length) { |
885 | content_len = BB_STRTOOFF(str, NULL, 10); | 892 | content_len = BB_STRTOOFF(str, NULL, 10); |
886 | if (errno || content_len < 0) { | 893 | if (errno || content_len < 0) { |