equal
deleted
inserted
replaced
26 package jdk.internal.net.http; |
26 package jdk.internal.net.http; |
27 |
27 |
28 import java.io.EOFException; |
28 import java.io.EOFException; |
29 import java.io.IOException; |
29 import java.io.IOException; |
30 import java.io.UncheckedIOException; |
30 import java.io.UncheckedIOException; |
31 import java.lang.System.Logger.Level; |
|
32 import java.net.InetSocketAddress; |
31 import java.net.InetSocketAddress; |
33 import java.net.URI; |
32 import java.net.URI; |
34 import java.nio.ByteBuffer; |
33 import java.nio.ByteBuffer; |
35 import java.nio.charset.StandardCharsets; |
34 import java.nio.charset.StandardCharsets; |
36 import java.util.Iterator; |
35 import java.util.Iterator; |
52 import java.net.http.HttpClient; |
51 import java.net.http.HttpClient; |
53 import java.net.http.HttpHeaders; |
52 import java.net.http.HttpHeaders; |
54 import jdk.internal.net.http.HttpConnection.HttpPublisher; |
53 import jdk.internal.net.http.HttpConnection.HttpPublisher; |
55 import jdk.internal.net.http.common.FlowTube; |
54 import jdk.internal.net.http.common.FlowTube; |
56 import jdk.internal.net.http.common.FlowTube.TubeSubscriber; |
55 import jdk.internal.net.http.common.FlowTube.TubeSubscriber; |
57 import jdk.internal.net.http.common.HttpHeadersImpl; |
56 import jdk.internal.net.http.common.HttpHeadersBuilder; |
58 import jdk.internal.net.http.common.Log; |
57 import jdk.internal.net.http.common.Log; |
59 import jdk.internal.net.http.common.Logger; |
58 import jdk.internal.net.http.common.Logger; |
60 import jdk.internal.net.http.common.MinimalFuture; |
59 import jdk.internal.net.http.common.MinimalFuture; |
61 import jdk.internal.net.http.common.SequentialScheduler; |
60 import jdk.internal.net.http.common.SequentialScheduler; |
62 import jdk.internal.net.http.common.Utils; |
61 import jdk.internal.net.http.common.Utils; |
79 import jdk.internal.net.http.hpack.Encoder; |
78 import jdk.internal.net.http.hpack.Encoder; |
80 import jdk.internal.net.http.hpack.Decoder; |
79 import jdk.internal.net.http.hpack.Decoder; |
81 import jdk.internal.net.http.hpack.DecodingCallback; |
80 import jdk.internal.net.http.hpack.DecodingCallback; |
82 import static java.nio.charset.StandardCharsets.UTF_8; |
81 import static java.nio.charset.StandardCharsets.UTF_8; |
83 import static jdk.internal.net.http.frame.SettingsFrame.*; |
82 import static jdk.internal.net.http.frame.SettingsFrame.*; |
84 |
|
85 |
83 |
86 /** |
84 /** |
87 * An Http2Connection. Encapsulates the socket(channel) and any SSLEngine used |
85 * An Http2Connection. Encapsulates the socket(channel) and any SSLEngine used |
88 * over it. Contains an HttpConnection which hides the SocketChannel SSL stuff. |
86 * over it. Contains an HttpConnection which hides the SocketChannel SSL stuff. |
89 * |
87 * |
790 return; |
788 return; |
791 } else { |
789 } else { |
792 nextPushStream += 2; |
790 nextPushStream += 2; |
793 } |
791 } |
794 |
792 |
795 HttpHeadersImpl headers = decoder.headers(); |
793 HttpHeaders headers = decoder.headers(); |
796 HttpRequestImpl pushReq = HttpRequestImpl.createPushRequest(parentReq, headers); |
794 HttpRequestImpl pushReq = HttpRequestImpl.createPushRequest(parentReq, headers); |
797 Exchange<T> pushExch = new Exchange<>(pushReq, parent.exchange.multi); |
795 Exchange<T> pushExch = new Exchange<>(pushReq, parent.exchange.multi); |
798 Stream.PushedStream<T> pushStream = createPushStream(parent, pushExch); |
796 Stream.PushedStream<T> pushStream = createPushStream(parent, pushExch); |
799 pushExch.exchImpl = pushStream; |
797 pushExch.exchImpl = pushStream; |
800 pushStream.registerStream(promisedStreamid); |
798 pushStream.registerStream(promisedStreamid); |
1301 + connection.getConnectionFlow() + ")"; |
1299 + connection.getConnectionFlow() + ")"; |
1302 } |
1300 } |
1303 |
1301 |
1304 static class HeaderDecoder extends ValidatingHeadersConsumer { |
1302 static class HeaderDecoder extends ValidatingHeadersConsumer { |
1305 |
1303 |
1306 HttpHeadersImpl headers; |
1304 HttpHeadersBuilder headersBuilder; |
1307 |
1305 |
1308 HeaderDecoder() { |
1306 HeaderDecoder() { |
1309 this.headers = new HttpHeadersImpl(); |
1307 this.headersBuilder = new HttpHeadersBuilder(); |
1310 } |
1308 } |
1311 |
1309 |
1312 @Override |
1310 @Override |
1313 public void onDecoded(CharSequence name, CharSequence value) { |
1311 public void onDecoded(CharSequence name, CharSequence value) { |
1314 String n = name.toString(); |
1312 String n = name.toString(); |
1315 String v = value.toString(); |
1313 String v = value.toString(); |
1316 super.onDecoded(n, v); |
1314 super.onDecoded(n, v); |
1317 headers.addHeader(n, v); |
1315 headersBuilder.addHeader(n, v); |
1318 } |
1316 } |
1319 |
1317 |
1320 HttpHeadersImpl headers() { |
1318 HttpHeaders headers() { |
1321 return headers; |
1319 return headersBuilder.build(); |
1322 } |
1320 } |
1323 } |
1321 } |
1324 |
1322 |
1325 /* |
1323 /* |
1326 * Checks RFC 7540 rules (relaxed) compliance regarding pseudo-headers. |
1324 * Checks RFC 7540 rules (relaxed) compliance regarding pseudo-headers. |