summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2010-02-25 18:28:25 +0000
committercorvid <corvid@lavabit.com>2010-02-25 18:28:25 +0000
commit485130cbcc9e60fb7cfab7f2253e30fb8c8dbe37 (patch)
tree306af048f1d4038497270dfa7c3636b159c30f9c /src/cache.c
parente46081b9e412275ec565261fc896d9444d069d64 (diff)
trim trailing whitespace from HTTP header fields
Reported by Andreas Kemnade http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-February/007353.html
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cache.c b/src/cache.c
index 6df062b3..2bd7bb58 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -590,6 +590,8 @@ static char *Cache_parse_field(const char *header, const char *fieldname)
/* Field found! */
while (header[++i] == ' ' || header[i] == '\t');
for (j = 0; header[i + j] != '\n'; j++);
+ while (j && (header[i + j - 1] == ' ' || header[i + j - 1] == '\t'))
+ j--;
field = dStrndup(header + i, j);
return field;
}
@@ -624,6 +626,8 @@ static Dlist *Cache_parse_multiple_fields(const char *header,
/* Field found! */
while (header[++i] == ' ' || header[i] == '\t');
for (j = 0; header[i + j] != '\n'; j++);
+ while (j && (header[i + j - 1] == ' ' || header[i + j - 1] == '\t'))
+ j--;
field = dStrndup(header + i, j);
dList_append(fields, field);
}