WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#10855 closed defect (bug) (fixed)

Some WP_HTTP methods support HTTP PUT, but WP doesn't expose that capability

Reported by: mdawaffe Owned by: dd32
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: HTTP API Keywords: has-patch commit
Focuses: Cc:

Description

The attached adds HTTP PUT support for WP_Http_ExtHTTP and WP_Http_Curl.

WP_Http_Curl tests out OK. WP_Http_ExtHTTP untested.

Attachments (1)

10855.diff (727 bytes) - added by mdawaffe 5 years ago.

Download all attachments as: .zip

Change History (5)

mdawaffe5 years ago

comment:1 follow-up: dd325 years ago

Does the ::test() methods check for PUT ability? Would be best to return a not-available error rather than attempting a PUT request with a transport that cant do it..

comment:2 in reply to: ↑ 1 ; follow-up: mdawaffe5 years ago

Replying to dd32:

Does the ::test() methods check for PUT ability? Would be best to return a not-available error rather than attempting a PUT request with a transport that cant do it..

::test() doesn't check. But as I understand it, all the methods we have that support POST can also support PUT.

This patch is the bare minimum necessary to support PUT requests in these two methods. Other methods supported PUT already.

With this patch:

  • WP_Http_Fsockopen: GET, HEAD, POST, PUT, (any)
  • WP_Http_Fopen: GET
  • WP_Http_Streams: GET, HEAD, POST, PUT, (any)
  • WP_Http_ExtHTTP: GET, HEAD, POST, PUT, (could support more: would need more hardcoding)
  • WP_Http_Curl: GET, HEAD, POST, PUT, (could support any: would need a default case in the switch)

comment:3 in reply to: ↑ 2 dd325 years ago

  • Keywords commit added; dev-feedback removed

Replying to mdawaffe:

::test() doesn't check. But as I understand it, all the methods we have that support POST can also support PUT.

Ah not to worry then :)

removed dev-feedback, I dont really think any is needed.

comment:4 azaozz5 years ago

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

In [11977]

Note: See TracTickets for help on using tickets.