Make WordPress Core


Ignore:
Timestamp:
02/03/2023 01:33:18 PM (2 years ago)
Author:
audrasjb
Message:

HTTP API: Fix request header inconsistencies.

This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-snoopy.php

    r47735 r55210  
    5454                                                // $cookies["username"]="joe";
    5555    var $rawheaders     =   array();            // array of raw headers to send
    56                                                 // $rawheaders["Content-type"]="text/html";
     56                                                // $rawheaders["Content-Type"]="text/html";
    5757
    5858    var $maxredirs      =   5;                  // http redirection depth maximum. 0 = disallow
     
    826826        }
    827827        if(!empty($content_type)) {
    828             $headers .= "Content-type: $content_type";
     828            $headers .= "Content-Type: $content_type";
    829829            if ($content_type == "multipart/form-data")
    830830                $headers .= "; boundary=".$this->_mime_boundary;
     
    832832        }
    833833        if(!empty($body))
    834             $headers .= "Content-length: ".strlen($body)."\r\n";
     834            $headers .= "Content-Length: ".strlen($body)."\r\n";
    835835        if(!empty($this->user) || !empty($this->pass))
    836836            $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
     
    991991        if(!empty($content_type)) {
    992992            if ($content_type == "multipart/form-data")
    993                 $headers[] = "Content-type: $content_type; boundary=".$this->_mime_boundary;
     993                $headers[] = "Content-Type: $content_type; boundary=".$this->_mime_boundary;
    994994            else
    995                 $headers[] = "Content-type: $content_type";
     995                $headers[] = "Content-Type: $content_type";
    996996        }
    997997        if(!empty($body))
    998             $headers[] = "Content-length: ".strlen($body);
     998            $headers[] = "Content-Length: ".strlen($body);
    999999        if(!empty($this->user) || !empty($this->pass))
    10001000            $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
Note: See TracChangeset for help on using the changeset viewer.