Returns an encoded header.
334593
public function getEncodedHeader(string $name): ?string
    {
        $offset = \strlen($name) + 2; // colon + space

        if (!isset($this->headers[$name])) {
            return null;
        }

        if (\is_array($this->headers[$name])) {
            $s = '';
            foreach ($this->headers[$name] as $email => $mailer) {
                if ($mailer != null) { // intentionally ==
                    $s .= self::encodeHeader($mailer, $offset, true);
                    $email = " <$email>";
                }
                $s .= self::append($email . ',', $offset);
            }

            return \ltrim(\substr($s, 0, -1)); // last comma
        }

        if (\preg_match('#^(\S+; (?:file)?name=)"(.*)"\z#', $this->headers[$name], $m)) { // Content-Disposition
            $offset += \strlen($m[1]);

            return $m[1] . '"' . self::encodeHeader($m[2], $offset) . '"';

        }

        return \ltrim(self::encodeHeader($this->headers[$name], $offset));
    }
1305094
def to_header(self, timestamp=None):
        """"""
        rv = [("sentry_key", self.public_key), ("sentry_version", self.version)]
        if timestamp is not None:
            rv.append(("sentry_timestamp", str(to_timestamp(timestamp))))
        if self.client is not None:
            rv.append(("sentry_client", self.client))
        if self.secret_key is not None:
            rv.append(("sentry_secret", self.secret_key))
        return u"Sentry " + u", ".join("%s=%s" % (key, value) for key, value in rv)
76228
def _generate_response_head_bytes(status_code, headers):
    

    head_string = str(status_code) + _DELIMITER_NEWLINE
    header_tuples = sorted((k, headers[k]) for k in headers)

    for name, value in header_tuples:
        name = _get_header_correctly_cased(name)

        if _should_sign_response_header(name):
            head_string += _FORMAT_HEADER_STRING.format(name, value)

    return (head_string + _DELIMITER_NEWLINE).encode()
1261432
def get_heading_encoding(response):
    '''
    '''
    encoding = wpull.protocol.http.util.parse_charset(
        response.fields.get('content-type', ''))

    if encoding:
        return wpull.string.normalize_codec_name(encoding)
    else:
        return None
851979
def Header(self):
    """"""
    # Call OnGetValue on options.
    _ = [option.OnGetValue() for option in self.options]
    return self.name
1163167
def header_check(self, content):
        """"""

        encode = None

        m = RE_PY_ENCODE.match(content)
        if m:
            if m.group(1):
                encode = m.group(1).decode('ascii')
            elif m.group(2):
                encode = m.group(2).decode('ascii')
        if encode is None:
            encode = 'utf-8'
        return encode
853654
public final static String getHeader(String headerKey, String charset) {
		return ServletUtil.getHeader(getServletRequest(), headerKey, charset);
	}
738832
def get_header(self, name, default=None):
        '''  '''
        return self._headers.get(_hkey(name), [default])[-1]
9755
def _encode_header(key: str, pdict: Dict[str, str]) -> str:
    
    if not pdict:
        return key
    out = [key]
    # Sort the parameters just to make it easy to test.
    for k, v in sorted(pdict.items()):
        if v is None:
            out.append(k)
        else:
            # TODO: quote if necessary.
            out.append("%s=%s" % (k, v))
    return "; ".join(out)
229478
def headers(self):
        """"""
        return {
            "Content-Type": ("multipart/form-data; boundary={}".format(self.boundary)),
            "Content-Length": str(self.len),
            "Content-Encoding": self.encoding,
        }
124945
public static function mimeHeaderDecode($header) {
    $callback = function ($matches) {
      $data = ($matches[2] == 'B') ? base64_decode($matches[3]) : str_replace('_', ' ', quoted_printable_decode($matches[3]));
      if (strtolower($matches[1]) != 'utf-8') {
        $data = static::convertToUtf8($data, $matches[1]);
      }
      return $data;
    };
    // First step: encoded chunks followed by other encoded chunks (need to collapse whitespace)
    $header = preg_replace_callback('/=\?([^?]+)\?(Q|B)\?([^?]+|\?(?!=))\?=\s+(?==\?)/', $callback, $header);
    // Second step: remaining chunks (do not collapse whitespace)
    return preg_replace_callback('/=\?([^?]+)\?(Q|B)\?([^?]+|\?(?!=))\?=/', $callback, $header);
  }
397859
def header_encode(header_bytes, charset='iso-8859-1'):
    
    if not header_bytes:
        return ""
    if isinstance(header_bytes, str):
        header_bytes = header_bytes.encode(charset)
    encoded = b64encode(header_bytes).decode("ascii")
    return '=?%s?b?%s?=' % (charset, encoded)
1075617
public String getHeader(String name)
    {
        HeaderField f = getHeaderField(name);
        if (f != null)
        {
            return f.getStringValue();
        }
        else
        {
            return null;
        }
    }
503960
def header(self) -> str:
        
        return "/".join((self.pipeline, self.phase, self.data))
1132417
def _get_header(self):
        """"""
        out = self._get_row(self.labels)
        out += "\n"
        out += self._get_row(["---"] * len(self.labels))  # line below headers
        return out
997570
public String header(Header name) {
		if(null == name) {
			return null;
		}
		return header(name.toString());
	}
106827
def escape_header(val):
    """"""

    if val is None:
        return None
    try:
        return quote(val, encoding="ascii", safe="/ ")
    except ValueError:
        return "utf-8''" + quote(val, encoding="utf-8", safe="/ ")