Bug 22920 - Apache should not add Content-Type header when there is no entity-body
Summary: Apache should not add Content-Type header when there is no entity-body
Status: RESOLVED DUPLICATE of bug 13986
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.0.47
Hardware: All All
: P3 normal with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-04 00:52 UTC by John Belmonte
Modified: 2007-09-15 07:09 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Belmonte 2003-09-04 00:52:15 UTC
At least in the context of a CGI script, when there is no entity-body and the
Content-Type header is not explicitly set, Apache should not add a Content-Type
header.  Several HTTP response types do not require an entity-body, and in such
a case Content-Type has no meaning and Apache should not be meddling.  RFC-2616
only says that any message *containing an entity-body* should include a
Content-Type header field.  It says no such thing for messages without a body.

Here is an example script:

  #!/bin/sh
  # test.cgi
  echo 'Status: 201 Created'
  echo 'Location: http://example.net/some_resource/234'
  echo

The current response is:
  HTTP/1.1 201 Created
  Location: http://example.net/some_resource/234
  Content-Type: text/plain; charset=ISO-8859-1
  Content-Length: 0

The desired response is:
  HTTP/1.1 201 Created
  Location: http://example.net/some_resource/234
  Content-Length: 0
Comment 1 Nick Kew 2007-09-15 07:03:26 UTC
We seem to have dropped the ball on this, but it's another instance of enforcing
a DefaultType.

*** This bug has been marked as a duplicate of 13986 ***
Comment 2 Julian Reschke 2007-09-15 07:09:27 UTC
I think I disagree this is the same as 13986.

This one is about not sending a Content-Type header when there is no entity body
at all. 13986 is about how to treat the case when a response body is sent, but
the content type is unknown.