summaryrefslogtreecommitdiff
path: root/std/textproto/mod.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/textproto/mod.ts')
-rw-r--r--std/textproto/mod.ts10
1 files changed, 2 insertions, 8 deletions
diff --git a/std/textproto/mod.ts b/std/textproto/mod.ts
index 06ffb7364..218ec9d44 100644
--- a/std/textproto/mod.ts
+++ b/std/textproto/mod.ts
@@ -74,22 +74,16 @@ export class TextProtoReader {
if (kv === Deno.EOF) throw new Deno.errors.UnexpectedEof();
if (kv.byteLength === 0) return m;
- // Key ends at first colon; should not have trailing spaces
- // but they appear in the wild, violating specs, so we remove
- // them if present.
+ // Key ends at first colon
let i = kv.indexOf(charCode(":"));
if (i < 0) {
throw new Deno.errors.InvalidData(
`malformed MIME header line: ${str(kv)}`
);
}
- let endKey = i;
- while (endKey > 0 && kv[endKey - 1] == charCode(" ")) {
- endKey--;
- }
//let key = canonicalMIMEHeaderKey(kv.subarray(0, endKey));
- const key = str(kv.subarray(0, endKey));
+ const key = str(kv.subarray(0, i));
// As per RFC 7230 field-name is a token,
// tokens consist of one or more chars.