Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10783 closed task (blessed) (fixed)

WordPress's GET function is sending a content-length of 0

Reported by: noel's profile noel Owned by: dd32's profile DD32
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: HTTP API Keywords: press this, http
Focuses: Cc:


Sending a content length of 0 with the GET request makes the request fail on some servers.

Sending a blank response of null or false works fine.

The included patch works well (and is necessary for Press This to function correctly under certain instances).

Attachments (2)

http.php.patch (534 bytes) - added by noel 15 years ago.
http.php patch
http.10783.diff (2.3 KB) - added by jacobsantos 15 years ago.
Actual fix for POST and PUT

Download all attachments as: .zip

Change History (8)

15 years ago

http.php patch

#1 @ryan
15 years ago

  • Milestone changed from Unassigned to 2.9
  • Resolution set to fixed
  • Status changed from new to closed

#2 @jacobsantos
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

A null value basically just removes that value from the array and doing so defeats the entire purpose of why it was put there in the first place.

The correct solution will be to test for POST if there isn't a body and set it. If there is a body, then set it.

The reason it was put there was become some servers require it to be there. So while it works for yours, it will not work for another server. A compromise or filter has to be made in order to ensure that it continues to work or allow for it to be made to work based on configurations.

#3 follow-up: @azaozz
15 years ago

This only affects GET requests, perhaps the workaround is to always send something to the server when doing a GET, like a single white space, etc. Then Content-Length will be 1.

#4 in reply to: ↑ 3 @azaozz
15 years ago

Meant to say "always send something to the server when doing a POST" above.

Related bug in PEAR was fixed by setting Content-Length only for POST and PUT requests.

15 years ago

Actual fix for POST and PUT

#5 @jacobsantos
15 years ago

New patch should correct fix problem.

#6 @ryan
15 years ago

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

(In [11937]) Fix content length setup. Props jacobsantos. fixes #10783

Note: See TracTickets for help on using tickets.