equal
deleted
inserted
replaced
34 import java.nio.ByteBuffer; |
34 import java.nio.ByteBuffer; |
35 import java.nio.charset.StandardCharsets; |
35 import java.nio.charset.StandardCharsets; |
36 import java.util.Iterator; |
36 import java.util.Iterator; |
37 import java.util.LinkedList; |
37 import java.util.LinkedList; |
38 import java.util.List; |
38 import java.util.List; |
|
39 import java.util.Locale; |
39 import java.util.Map; |
40 import java.util.Map; |
40 import java.util.Set; |
41 import java.util.Set; |
41 import java.util.concurrent.CompletableFuture; |
42 import java.util.concurrent.CompletableFuture; |
42 import java.util.ArrayList; |
43 import java.util.ArrayList; |
43 import java.util.Objects; |
44 import java.util.Objects; |
424 boolean isSecure = connection.isSecure(); |
425 boolean isSecure = connection.isSecure(); |
425 InetSocketAddress addr = connection.address(); |
426 InetSocketAddress addr = connection.address(); |
426 |
427 |
427 return keyString(isSecure, isProxy, addr.getHostString(), addr.getPort()); |
428 return keyString(isSecure, isProxy, addr.getHostString(), addr.getPort()); |
428 } |
429 } |
429 |
430 |
430 static String keyFor(URI uri, InetSocketAddress proxy) { |
431 static String keyFor(URI uri, InetSocketAddress proxy) { |
431 boolean isSecure = uri.getScheme().equalsIgnoreCase("https"); |
432 boolean isSecure = uri.getScheme().equalsIgnoreCase("https"); |
432 boolean isProxy = proxy != null; |
433 boolean isProxy = proxy != null; |
433 |
434 |
434 String host; |
435 String host; |
958 private List<ByteBuffer> encodeHeadersImpl(int maxFrameSize, HttpHeaders... headers) { |
959 private List<ByteBuffer> encodeHeadersImpl(int maxFrameSize, HttpHeaders... headers) { |
959 ByteBuffer buffer = getHeaderBuffer(maxFrameSize); |
960 ByteBuffer buffer = getHeaderBuffer(maxFrameSize); |
960 List<ByteBuffer> buffers = new ArrayList<>(); |
961 List<ByteBuffer> buffers = new ArrayList<>(); |
961 for(HttpHeaders header : headers) { |
962 for(HttpHeaders header : headers) { |
962 for (Map.Entry<String, List<String>> e : header.map().entrySet()) { |
963 for (Map.Entry<String, List<String>> e : header.map().entrySet()) { |
963 String lKey = e.getKey().toLowerCase(); |
964 String lKey = e.getKey().toLowerCase(Locale.US); |
964 List<String> values = e.getValue(); |
965 List<String> values = e.getValue(); |
965 for (String value : values) { |
966 for (String value : values) { |
966 hpackOut.header(lKey, value); |
967 hpackOut.header(lKey, value); |
967 while (!hpackOut.encode(buffer)) { |
968 while (!hpackOut.encode(buffer)) { |
968 buffer.flip(); |
969 buffer.flip(); |