WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#3545 closed defect (bug) (fixed)

Content-Type header case sensitive

Reported by: johnleach Owned by: 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 7 years ago.
Left the cases in projects that WP includes
3545.diff (8.1 KB) - added by Nazgul 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 johnleach7 years ago

  • Cc john@… added

comment:2 markjaquith7 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.

comment:3 johnleach7 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.

foolswisdom7 years ago

Left the cases in projects that WP includes

comment:4 foolswisdom7 years ago

  • Keywords has-patch added

comment:5 markjaquith7 years ago

  • Keywords needs-patch added; has-patch removed

Doesn't apply cleanly. Feed files moved.

comment:6 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.4

Nazgul7 years ago

comment:7 Nazgul7 years ago

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

Patch refreshed

comment:8 rob1n7 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.