src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java
branchhttp-client-branch
changeset 56041 b4b5e09ef3cc
parent 56036 89a688549f5d
child 56054 352e845ae744
equal deleted inserted replaced
56040:f8eabb9a5c0f 56041:b4b5e09ef3cc
   100     static {
   100     static {
   101         // A case insensitive TreeSet of strings.
   101         // A case insensitive TreeSet of strings.
   102         TreeSet<String> treeSet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
   102         TreeSet<String> treeSet = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
   103         treeSet.addAll(Set.of("connection", "content-length",
   103         treeSet.addAll(Set.of("connection", "content-length",
   104                 "date", "expect", "from", "host", "origin",
   104                 "date", "expect", "from", "host", "origin",
   105                 "proxy-authorization", "referer", "upgrade",
   105                 "referer", "upgrade",
   106                 "via", "warning"));
   106                 "via", "warning"));
   107         DISALLOWED_HEADERS_SET = Collections.unmodifiableSet(treeSet);
   107         DISALLOWED_HEADERS_SET = Collections.unmodifiableSet(treeSet);
   108     }
   108     }
       
   109 
   109     public static final Predicate<String>
   110     public static final Predicate<String>
   110         ALLOWED_HEADERS = header -> !Utils.DISALLOWED_HEADERS_SET.contains(header);
   111         ALLOWED_HEADERS = header -> !DISALLOWED_HEADERS_SET.contains(header);
       
   112 
       
   113     public static final Predicate<String> IS_PROXY_HEADER = (k) ->
       
   114             k != null && k.length() > 6 && "proxy-".equalsIgnoreCase(k.substring(0,6));
       
   115     public static final Predicate<String> NO_PROXY_HEADER =
       
   116             IS_PROXY_HEADER.negate();
       
   117     public static final Predicate<String> ALL_HEADERS = (s) -> true;
   111 
   118 
   112     public static ByteBuffer getBuffer() {
   119     public static ByteBuffer getBuffer() {
   113         return ByteBuffer.allocate(BUFSIZE);
   120         return ByteBuffer.allocate(BUFSIZE);
   114     }
   121     }
   115 
   122