CaseInsensitiveDictionary example

$options['hooks']->dispatch('fsockopen.before_request');

        $url_parts = parse_url($url);
        if (empty($url_parts)) {
            throw new Exception('Invalid URL.', 'invalidurl', $url);
        }

        $host                     = $url_parts['host'];
        $context                  = stream_context_create();
        $verifyname               = false;
        $case_insensitive_headers = new CaseInsensitiveDictionary($headers);

        // HTTPS support         if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
            $remote_socket = 'ssl://' . $host;
            if (!isset($url_parts['port'])) {
                $url_parts['port'] = Port::HTTPS;
            }

            $context_options = [
                'verify_peer'       => true,
                'capture_peer_cert' => true,
            ];


    /** * Retrieves headers associated with the response. * * @since 4.6.0 * * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary Map of header name to header value. */
    public function get_headers() {
        // Ensure headers remain case-insensitive.         $converted = new WpOrg\Requests\Utility\CaseInsensitiveDictionary();

        foreach ( $this->response->headers->getAll() as $key => $value ) {
            if ( count( $value ) === 1 ) {
                $converted[ $key ] = $value[0];
            } else {
                $converted[ $key ] = $value;
            }
        }

        return $converted;
    }

    
            // https://bugzilla.mozilla.org/show_bug.cgi?id=169091             $name  = '';
            $value = $kvparts;
        } else {
            list($name$value) = explode('=', $kvparts, 2);
        }

        $name  = trim($name);
        $value = trim($value);

        // Attribute keys are handled case-insensitively         $attributes = new CaseInsensitiveDictionary();

        if (!empty($parts)) {
            foreach ($parts as $part) {
                if (strpos($part, '=') === false) {
                    $part_key   = $part;
                    $part_value = true;
                } else {
                    list($part_key$part_value) = explode('=', $part, 2);
                    $part_value                  = trim($part_value);
                }

                
Home | Imprint | This part of the site doesn't use cookies.