Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#8249 closed enhancement (fixed)

Set content-length for HTTP API when the developer doesn't manually set it.

Reported by: jacobsantos's profile jacobsantos Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Optimization Keywords: has-patch commit
Focuses: Cc:


There might be some instances when the developer does not set the content-length and servers might not work directly. There is also a known instance where mod_security will reject HTTP POST requests that don't have the header set.

The patch sets the value if the developer doesn't already set it.

Attachments (1)

8249.r9729.diff (448 bytes) - added by jacobsantos 16 years ago.
patch based off of r9729.

Download all attachments as: .zip

Change History (4)

16 years ago

patch based off of r9729.

#1 @DD32
16 years ago

IMO, the Developer shouldnt be setting the content length at all, That should be taken care of by the Class.

I'd personally prefer it to be written as:

214	    $options = array(
215	        'method'        => 'POST',
216	        'timeout'        => 3,
217	        'body'            => array('themes' => serialize( $themes ) ),
	        'headers'	 => array();
218	    );

225	    $raw_response = wp_remote_request( '', $options );

Oh, And wouldnt it be better to pull the lines above that patch (Lines 249, 250) out of that block and set them for any requests which need it, rather than duplicating the line?

#2 @jacobsantos
16 years ago


You are correct. All code should be as you said, but should be made in a new ticket.

#3 @ryan
16 years ago

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

(In [9741]) Auto set content-length. Props jacobsantos. fixes #8249

Note: See TracTickets for help on using tickets.