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 | Owned by: | |
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Optimization | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
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)
Change History (4)
#1
@
16 years ago
IMO, the Developer shouldnt be setting the content length at all, That should be taken care of by the Class.
Eg: http://trac.wordpress.org/browser/trunk/wp-includes/update.php#L214[[Br]]
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( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
Oh, And wouldnt it be better to pull the lines above that patch http://trac.wordpress.org/browser/trunk/wp-includes/http.php#L249 (Lines 249, 250) out of that block and set them for any requests which need it, rather than duplicating the line?
patch based off of r9729.