Opened 2 months ago
Last modified 9 days ago
#54225 new enhancement
Request header key case inconsistencies
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 6.0 | Priority: | normal |
Severity: | normal | Version: | 2.7 |
Component: | HTTP API | Keywords: | 2nd-opinion needs-patch |
Focuses: | docs | Cc: |
Description
RFCs 7230 and 7540 define header keys as case-insensitive.
WordPress is consistently inconsistent when it comes to :
- Retrieving headers – always
lowercase
:wp_remote_retrieve_header( $response, 'content-md5' )`
- Setting headers – almost always
Capital-Case
:header( 'Content-Type: text/html; charset=utf-8' );
- Sitemaps code (from 5.5) uses
Title-case
:header( 'Content-type: application/xml; charset=UTF-8' );
(Thankfully, when it comes to actually using the wp_remote_retrieve_header()
function (and subsequently the Requests API and WP4.6) it resolves down to Requests_Utility_CaseInsensitiveDictionary
so it is all working as defined in the specification.)
Possible code/docs improvements here include:
- standardizing when core uses which case
- explicitly stating that header key parameters are case-insensitive
Change History (3)
Note: See
TracTickets for help on using
tickets.
5.9 is in feature freeze and Beta 1 release is < 4 hours away, moving this to 6.0.