Copies the header list and obfuscates the "cookie" header in case it
contains auth tokens, etc. Note that it flattens duplicate headers keys
as comma separated lists per the RFC
@return The full set of headers for this query with the cookie obfuscated
540868
public Map<String, String> getPrintableHeaders() {
    final Map<String, String> headers = new HashMap<String, String>(
        request.headers().entries().size());
    for (final Entry<String, String> header : request.headers().entries()) {
      if (header.getKey().toLowerCase().equals("cookie")) {
        // null out the cookies
        headers.put(header.getKey(), "*******");
      } else {
        // http://tools.ietf.org/html/rfc2616#section-4.2
        if (headers.containsKey(header.getKey())) {
          headers.put(header.getKey(), 
              headers.get(header.getKey()) + "," + header.getValue());
        } else {
          headers.put(header.getKey(), header.getValue());
        }
      }
    }
    return headers;
  }
1259510
public function getHeaders()
    {
        if ($this->headers) {
            return $this->headers;
        }

        $this->headers = [
            'STATUS' => $this->code(),
        ];

        $originHeaders = explode("\r\n\r\n", $this->originHeaders);
        $originHeader = array_pop($originHeaders);
        foreach (explode("\r\n", $originHeader) as $i => $header) {
            if ($i == 0 || !$header) {
                continue;
            }

            $header = explode(':', $header, 2);
            $header[0] = strtoupper($header[0]);
            if ($header[0] == 'SET-COOKIE') {
                $this->headers[$header[0]][] = isset($header[1]) ? trim($header[1]) : '';
            } else {
                $this->headers[$header[0]] = isset($header[1]) ? trim($header[1]) : '';
            }
        }

        return $this->headers;
    }
904068
private Set<Cookie> doDecode(String header) {
        List<String> names = new ArrayList<String>(8);
        List<String> values = new ArrayList<String>(8);
        extractKeyValuePairs(header, names, values);

        if (names.isEmpty()) {
            return Collections.emptySet();
        }

        int i;
        int version = 0;

        // $Version is the only attribute that can appear before the actual
        // cookie name-value pair.
        if (names.get(0).equalsIgnoreCase(VERSION)) {
            try {
                version = Integer.parseInt(values.get(0));
            } catch (NumberFormatException e) {
                // Ignore.
            }
            i = 1;
        } else {
            i = 0;
        }

        if (names.size() <= i) {
            // There's a version attribute, but nothing more.
            return Collections.emptySet();
        }

        Set<Cookie> cookies = new TreeSet<Cookie>();
        for (; i < names.size(); i ++) {
            String name = names.get(i);
            String value = values.get(i);
            if (value == null) {
                value = "";
            }

            Cookie c = initCookie(name, value);

            if (c == null) {
                break;
            }

            boolean discard = false;
            boolean secure = false;
            boolean httpOnly = false;
            String comment = null;
            String commentURL = null;
            String domain = null;
            String path = null;
            long maxAge = Long.MIN_VALUE;
            List<Integer> ports = new ArrayList<Integer>(2);

            for (int j = i + 1; j < names.size(); j++, i++) {
                name = names.get(j);
                value = values.get(j);

                if (DISCARD.equalsIgnoreCase(name)) {
                    discard = true;
                } else if (CookieHeaderNames.SECURE.equalsIgnoreCase(name)) {
                    secure = true;
                } else if (CookieHeaderNames.HTTPONLY.equalsIgnoreCase(name)) {
                   httpOnly = true;
                } else if (COMMENT.equalsIgnoreCase(name)) {
                    comment = value;
                } else if (COMMENTURL.equalsIgnoreCase(name)) {
                    commentURL = value;
                } else if (CookieHeaderNames.DOMAIN.equalsIgnoreCase(name)) {
                    domain = value;
                } else if (CookieHeaderNames.PATH.equalsIgnoreCase(name)) {
                    path = value;
                } else if (CookieHeaderNames.EXPIRES.equalsIgnoreCase(name)) {
                    Date date = DateFormatter.parseHttpDate(value);
                    if (date != null) {
                        long maxAgeMillis = date.getTime() - System.currentTimeMillis();
                        maxAge = maxAgeMillis / 1000 + (maxAgeMillis % 1000 != 0? 1 : 0);
                    }
                } else if (CookieHeaderNames.MAX_AGE.equalsIgnoreCase(name)) {
                    maxAge = Integer.parseInt(value);
                } else if (VERSION.equalsIgnoreCase(name)) {
                    version = Integer.parseInt(value);
                } else if (PORT.equalsIgnoreCase(name)) {
                    String[] portList = value.split(",");
                    for (String s1: portList) {
                        try {
                            ports.add(Integer.valueOf(s1));
                        } catch (NumberFormatException e) {
                            // Ignore.
                        }
                    }
                } else {
                    break;
                }
            }

            c.setVersion(version);
            c.setMaxAge(maxAge);
            c.setPath(path);
            c.setDomain(domain);
            c.setSecure(secure);
            c.setHttpOnly(httpOnly);
            if (version > 0) {
                c.setComment(comment);
            }
            if (version > 1) {
                c.setCommentUrl(commentURL);
                c.setPorts(ports);
                c.setDiscard(discard);
            }

            cookies.add(c);
        }

        return cookies;
    }
1184624
@Override
    public Set<HeaderField> getHeaders() {
        HashSet<HeaderField> headerFields = new HashSet<HeaderField>();

        if (_headers.size() > 0) {
            Iterator<String> headerNames = _headers.keySet().iterator();
            while (headerNames.hasNext()) {
                Iterator<HttpHeaderField> headers = _headers.get(headerNames.next()).iterator();
                while (headers.hasNext()) {
                    HttpHeaderField field = headers.next();
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "getHeaders()", "add header name = " + field.getName() + ", value = " + field.asString());
                    }
                    headerFields.add(field);
                }
            }
        }

        return headerFields;
    }
51763
public function getAllHeaders()
    {
        $headers = $this->headers;
        if ($this->cookies) {
            $headers['Set-Cookie'] = array_values($this->cookies);
        }

        return $headers;
    }
647143
public List<ByteBuffer> getAuthorizationsBB() {
        ArrayList<ByteBuffer> copy = new ArrayList<ByteBuffer>(authsList.size());
        for (byte[] auth : authsList) {
            byte[] bytes = new byte[auth.length];
            System.arraycopy(auth, 0, bytes, 0, auth.length);
            copy.add(ByteBuffer.wrap(bytes));
        }
        return Collections.unmodifiableList(copy);
    }
471933
@Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        Map<String, String> headers = super.getHeaders();
        if (!mRequestHeaders.isEmpty()) {
            if (headers.isEmpty()) {
                return mRequestHeaders;
            } else {
                headers.putAll(mRequestHeaders);
            }
        }
        return headers;
    }
811250
public static String getHeaders(HttpServletResponse response) {
        String headerString = "";
        Collection<String> headerNames = response.getHeaderNames();
        for (String headerName : headerNames) {
            // there may be multiple headers per header name
            for (String headerValue : response.getHeaders(headerName)) {
                if (headerString.length() != 0) {
                    headerString += "\n";
                }

                headerString += headerName + ": " + headerValue;
            }
        }

        return headerString;
    }
539418
public static Cookie[] parseCookieHeader( String header ) {

        if ((header == null) || (header.length() < 1)) {
            return (new Cookie[0]);
        }

        ArrayList<Cookie> cookies = new ArrayList<Cookie>();
        while (header.length() > 0) {
            int semicolon = header.indexOf(';');
            if (semicolon < 0) {
                semicolon = header.length();
            }
            if (semicolon == 0) {
                break;
            }
            String token = header.substring(0, semicolon);
            if (semicolon < header.length()) {
                header = header.substring(semicolon + 1);
            } else {
                header = "";
            }
            try {
                int equals = token.indexOf('=');
                if (equals > 0) {
                    String name = token.substring(0, equals).trim();
                    String value = token.substring(equals + 1).trim();
                    cookies.add(new Cookie(name, value));
                }
            } catch (Throwable e) {
                // do nothing ?!
            }
        }

        return cookies.toArray(new Cookie[cookies.size()]);
    }
380301
def headerlist(self):
        
        out = []
        headers = list(self._headers.items())
        if 'Content-Type' not in self._headers:
            headers.append(('Content-Type', [self.default_content_type]))
        if self._status_code in self.bad_headers:
            bad_headers = self.bad_headers[self._status_code]
            headers = [h for h in headers if h[0] not in bad_headers]
        out += [(name, val) for (name, vals) in headers for val in vals]
        if self._cookies:
            for c in self._cookies.values():
                out.append(('Set-Cookie', _hval(c.OutputString())))
        if py3k:
            out = [(k, v.encode('utf8').decode('latin1')) for (k, v) in out]
        return out
860494
public static List<Cookie> cookies(){
        javax.servlet.http.Cookie[] servletCookies = RequestContext.getHttpRequest().getCookies();
        if(servletCookies == null)
            return new ArrayList<>();

        List<Cookie> cookies = new ArrayList<>();
        for (javax.servlet.http.Cookie servletCookie: servletCookies) {
            Cookie cookie = Cookie.fromServletCookie(servletCookie);
            cookies.add(cookie);
        }
        return cookies;
    }
520299
private void copyResponseHeaders(HttpResponse proxyResponse, final HttpServletResponse servletResponse) {
        servletResponse.setCharacterEncoding(getContentCharSet(proxyResponse.getEntity()));
        from(Arrays.asList(proxyResponse.getAllHeaders())).filter(new Predicate<Header>() {
            @Override
            public boolean apply(Header header) {
                return !hopByHopHeaders.containsHeader(header.getName());
            }
        }).transform(new Function<Header, Boolean>() {
            @Override
            public Boolean apply(Header header) {
                servletResponse.addHeader(header.getName(), header.getValue());
                return true;
            }
        }).toList();
    }
117410
public List<HeaderEntry> getHeaderEntryList() {
    final List<HeaderEntry> list = new ArrayList<>();
    final Iterator it = this.headers.entrySet().iterator();
    while (it.hasNext()) {
      final Map.Entry pair = (Map.Entry)it.next();
      System.out.println(pair.getKey() + " = " + pair.getValue());
      final HeaderEntry e = HeaderEntry.newBuilder()
              .setKey((String) pair.getKey())
              .setValue((String) pair.getValue())
              .build();
      list.add(e);
      it.remove(); // avoids a ConcurrentModificationException
    }
    return list;
  }
1141070
public Collection<String> getEncryptTableNames() {
        Set<String> result = new LinkedHashSet<>();
        for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
            result.addAll(each.getEncryptTableNames());
        }
        return result;
    }
1251520
def cookies(self) -> Mapping[str, str]:
        
        raw = self.headers.get(hdrs.COOKIE, '')
        parsed = SimpleCookie(raw)
        return MappingProxyType(
            {key: val.value for key, val in parsed.items()})
857085
public List<HttpCookie> getCookies() {
        List<HttpCookie> rt = new ArrayList<HttpCookie>();

        lock.lock();
        try {
            for (List<HttpCookie> list : uriIndex.values()) {
                Iterator<HttpCookie> it = list.iterator();
                while (it.hasNext()) {
                    HttpCookie cookie = it.next();
                    if (cookie.hasExpired()) {
                        it.remove();
                    } else if (!rt.contains(cookie)) {
                        rt.add(cookie);
                    }
                }
            }
        } finally {
            rt = Collections.unmodifiableList(rt);
            lock.unlock();
        }

        return rt;
    }
1278869
public String[] getHeaders() throws IOException {
		checkClosed();

		if (headersHolder.Headers == null) {
			return null;
		} else {
			// use clone here to prevent the outside code from
			// setting values on the array directly, which would
			// throw off the index lookup based on header name
			String[] clone = new String[headersHolder.Length];
			System.arraycopy(headersHolder.Headers, 0, clone, 0,
					headersHolder.Length);
			return clone;
		}
	}