Opened 11 years ago
Closed 9 years ago
#24598 closed enhancement (fixed)
Allow custom headers in XML-RPC request
Reported by: | ericmann | Owned by: | chriscct7 |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | XML-RPC | Keywords: | has-patch |
Focuses: | Cc: |
Description
WordPress avails an override to the default IXR_Client
object that uses its own WP_Http
wrapper for making the request. The wrapper itself is pluggable, but there are no filters before the call to wp_remote_post
that allow developers to intercept and modify the request.
As a result, sending custom headers with the request (like cookies) requires developers in turn override IXR_Client
with their own implementation in order to add the custom data. One example, which specifically addresses sending cookies with the request, is https://gist.github.com/ericmann/5808805.
Instead, the built-in WP_HTTP_IXR_Client
object should pass its header array through a WordPress filter before building the remote request. Developers can hook in to this filter to add their own custom headers - be they cookies, authentication, language, or whatever.
Attachments (3)
Change History (13)
#1
@
11 years ago
The patch adds brackets to the existing single-line conditional statements in the file as the indentation can be tricky to follow and what the code is doing here should be absolutely clear.
#2
@
11 years ago
I had this requirement (to send cookies in my request) and Eric offered to help. This was a simple and quick fix, and exactly what I needed. I've already got it working on one installation and I'll have it on my other two installations by COB.
#3
@
9 years ago
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to 4.4
- Owner set to chriscct7
- Status changed from new to assigned
- Version changed from 3.5.1 to 3.5
#4
@
9 years ago
- Keywords needs-refresh removed
Updated patch file against the new development repository :-)
Patch adding a filter to request headers.