WordPress.org

Make WordPress Core

Ticket #17588: post-to-get-fsockopen.diff

File post-to-get-fsockopen.diff, 739 bytes (added by wonderboymusic, 6 years ago)
  • wp-includes/class-http.php

     
    781781                // If location is found, then assume redirect and redirect to location.
    782782                if ( isset($arrHeaders['headers']['location']) && 0 !== $r['_redirection'] ) {
    783783                        if ( $r['redirection']-- > 0 ) {
     784                                if ( in_array( $arrHeaders['response']['code'], array( 302, 303 ) ) && 'POST' == $r['method'] )
     785                                        $r['method'] = 'GET';
     786                               
    784787                                return $this->request( WP_HTTP::make_absolute_url( $arrHeaders['headers']['location'], $url ), $r);
    785788                        } else {
    786789                                return new WP_Error('http_request_failed', __('Too many redirects.'));