diff options
author | corvid <corvid@lavabit.com> | 2009-10-25 16:30:33 +0000 |
---|---|---|
committer | corvid <corvid@lavabit.com> | 2009-10-25 16:30:33 +0000 |
commit | a5e4b9b07c9c6cd8d8579b01ae1d5cd80710c24d (patch) | |
tree | 369ed7152446471197644e34067f06f52f814345 | |
parent | fc1c91f5aa3d8d2ca35f6f203de5c853bed27a0f (diff) |
only require Content-Type HTTP header if there was, or should have been, a body
-rw-r--r-- | src/cache.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cache.c b/src/cache.c index 919dbcd6..12e411f8 100644 --- a/src/cache.c +++ b/src/cache.c @@ -758,12 +758,7 @@ static void Cache_parse_header(CacheEntry_t *entry) } /* Get Content-Type */ - if ((Type = Cache_parse_field(header, "Content-Type")) == NULL) { - if (!((entry->Flags & CA_GotLength) && (entry->ExpectedSize == 0))) { - /* unless the server sent Content-Length: 0 */ - MSG_HTTP("Server didn't send Content-Type in header.\n"); - } - } else { + if ((Type = Cache_parse_field(header, "Content-Type"))) { /* This HTTP Content-Type is not trusted. It's checked against real data * in Cache_process_queue(); only then CA_GotContentType becomes true. */ a_Cache_set_content_type(entry->Url, Type, "http"); @@ -874,6 +869,10 @@ void a_Cache_process_dbuf(int Op, const char *buf, size_t buf_size, entry = Cache_process_queue(entry); } } else if (Op == IOClose) { + if ((entry->ExpectedSize || entry->TransferSize) && + entry->TypeHdr == NULL) { + MSG_HTTP("Message with a body lacked Content-Type header.\n"); + } if ((entry->Flags & CA_GotLength) && (entry->ExpectedSize != entry->TransferSize)) { MSG_HTTP("Content-Length does NOT match message body,\n" |