Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#3545 closed defect (bug) (fixed)

Content-Type header case sensitive

Reported by: johnleach's profile johnleach Owned by: markjaquith's profile markjaquith
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.0.6
Component: General Keywords: headers mime type http wp-cache has-patch
Focuses: Cc:

Description

Wordpress 2.0.6 (and below) use of the Content-Type header is inconsistent. In most places it sends "Content-Type" but in some, particularly the RSS templates, it sends "Content-type" (note the lowercase 't')

RFC2616 implies that this header is case sensitive.

I came across this whilst using the WP-Cache plugin. It is strict about the header case and ignores the RSS feed content types, overriding it with it's own default of html/text. So WP-Cached RSS feeds end up with the wrong content-type, breaking some feed readers.

Attachments (2)

3545-Content-Type.diff (7.6 KB) - added by foolswisdom 18 years ago.
Left the cases in projects that WP includes
3545.diff (8.1 KB) - added by Nazgul 18 years ago.

Download all attachments as: .zip

Change History (10)

#1 @johnleach
18 years ago

  • Cc john@… added

#2 @markjaquith
18 years ago

  • Milestone changed from 2.0.7 to 2.2
  • Owner changed from anonymous to markjaquith
  • Status changed from new to assigned

RFC2616 explicitly says that HTTP headers are case-insensitive. That said, it doesn't hurt us to capitalize them as they are presented in the RFC. Well-behaved clients won't care and lazy clients will more likely than not use the capitalization that the RFC uses.

The only problem I see is that some of the instances in WP of "Content-type" are in external libraries like Snoopy or TinyMCE. Changing those may present an added burden for maintenance.

At any rate, 2.2 territory.

#3 @johnleach
18 years ago

Doh, I see now that I was looking at only one section of the RFC (duh). It does state that they are case-insensitive so this is definitely a bug in WP-Cache (which I've reported). Thanks Mark.

@foolswisdom
18 years ago

Left the cases in projects that WP includes

#4 @foolswisdom
18 years ago

  • Keywords has-patch added

#5 @markjaquith
18 years ago

  • Keywords needs-patch added; has-patch removed

Doesn't apply cleanly. Feed files moved.

#6 @foolswisdom
18 years ago

  • Milestone changed from 2.2 to 2.4

@Nazgul
18 years ago

#7 @Nazgul
18 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from 2.4 to 2.3

Patch refreshed

#8 @rob1n
18 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [5640]) Content-Type, not Content-type, as headers are case sensitive. Props foolswisdom and Nazgul. fixes #3545

Note: See TracTickets for help on using tickets.