You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2016/09/18 11:29:33 UTC
svn commit: r1761318 [1/8] - in /httpcomponents/httpcore/trunk:
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/ httpcore5-h2/...
Author: olegk
Date: Sun Sep 18 11:29:30 2016
New Revision: 1761318
URL: http://svn.apache.org/viewvc?rev=1761318&view=rev
Log:
RFC 7540: initial implementation of the HTTP/2 stream multiplexer
Added:
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java (contents, props changed)
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Param.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/StreamIdGenerator.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2StreamMultiplexer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2IOEventHandler.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttp2StreamMultiplexer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiator.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientHttpProtocolNegotiatorFactory.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientPushHttp2StreamHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/Http2StreamChannel.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/Http2StreamHandler.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/Http2StreamListener.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/HttpErrorListener.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/MessageState.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2IOEventHandler.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttp2StreamMultiplexer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiator.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerHttpProtocolNegotiatorFactory.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ServerPushHttp2StreamHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AbstractAsyncExchangeHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AbstractAsyncPushHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AbstractClassicExchangeHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncDataConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncDataProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncEntityConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncEntityProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncExchangeHandler.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncPushConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncPushProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncRequestConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncRequestProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/AsyncResponseTrigger.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/BasicPushProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/BasicRequestConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/BasicRequestProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/BasicResponseConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/BasicResponseProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/CapacityChannel.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/DataStreamChannel.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/FixedResponseExchangeHandler.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/HandlerFactory.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/ResourceHolder.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/ResponseChannel.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/StreamChannel.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/Supplier.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/command/
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/command/ClientCommandEndpoint.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/command/ExecutionCommand.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/command/ShutdownCommand.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/command/ShutdownType.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractBinAsyncEntityConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractBinAsyncEntityProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractCharAsyncEntityConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractCharAsyncEntityProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractClassicEntityConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractClassicEntityProducer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/AbstractSharedBuffer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/ByteArrayAsyncEntityConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/ByteArrayAsyncEntityProducer.java (contents, props changed)
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/NoopEntityConsumer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestUserAgent.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/SharedInputBuffer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/SharedOutputBuffer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/StringAsyncEntityConsumer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/nio/entity/StringAsyncEntityProducer.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseServer.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/ReadableByteChannelMock.java (contents, props changed)
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/ReadableByteChannelMock.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java (contents, props changed)
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/WritableByteChannelMock.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2IntegrationTest.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestClient.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/Http2TestServer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalClientHttp2EventHandlerFactory.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttp2StreamListener.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalHttpErrorListener.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerHttp2EventHandlerFactory.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/InternalServerTestBase.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/LogAppendable.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestUserAgent.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/integration/LoggingIOSession.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingIOSession.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/nio/
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/nio/entity/
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/nio/entity/TestSharedInputBuffer.java (with props)
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/nio/entity/TestSharedOutputBuffer.java (with props)
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/Message.java (contents, props changed)
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/Command.java
- copied, changed from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
Removed:
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Param.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/ReadableByteChannelMock.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/WritableByteChannelMock.java
Modified:
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/DefaultFrameFactory.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFactory.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HuffmanEncoder.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2RequestConverter.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2ResponseConverter.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameOutputBuffer.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestDefaultFrameFactory.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/HttpStatus.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/DefaultConnectionReuseStrategy.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/EnglishReasonPhraseCatalog.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/BHttpConnectionBase.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpClientConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultBHttpServerConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/DefaultHttpResponseParser.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpRequestExecutor.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/HttpService.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractAsyncRequestConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractAsyncResponseConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncClientExchangeHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncRequestConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncRequestHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncRequestProducer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncResponseConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BasicAsyncResponseProducer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpRequestParser.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultHttpResponseParser.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpClientConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/DefaultNHttpServerConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ErrorResponseProducer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncRequestExecutor.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/HttpAsyncService.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/NHttpConnectionBase.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/PipeliningClientExchangeHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SSLNHttpClientConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SSLNHttpServerConnectionFactory.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SharedInputBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SharedOutputBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/SimpleOutputBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/BHttpConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpRequestHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/io/HttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/message/HeaderGroup.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/HttpAsyncClientExchangeHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/HttpAsyncRequestConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/HttpAsyncRequestHandler.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/HttpAsyncRequestProducer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/HttpAsyncResponseConsumer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpClientConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/NHttpServerConnection.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/SessionInputBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/nio/SessionOutputBuffer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/pool/io/BasicConnPool.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpCoreContext.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/HttpExpectationVerifier.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ImmutableHttpProcessor.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestConnControl.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestDate.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestExpectContinue.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestTargetHost.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestUserAgent.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestValidateHost.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseConnControl.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseContent.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseDate.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/http/protocol/ResponseServer.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/DefaultConnectingIOReactor.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSession.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/IOSessionImpl.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
httpcomponents/httpcore/trunk/httpcore5/src/main/java/org/apache/hc/core5/util/NetUtils.java
httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestNHttpConnectionBase.java
httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/testserver/nio/LoggingIOSession.java
httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/pool/io/TestConnPool.java
Copied: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java (from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java?p2=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java&r1=1761317&r2=1761318&rev=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamException.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/H2StreamResetException.java Sun Sep 18 11:29:30 2016
@@ -30,34 +30,25 @@ import java.io.IOException;
import org.apache.hc.core5.util.Args;
-public class H2StreamException extends IOException {
+public class H2StreamResetException extends IOException {
private static final long serialVersionUID = 6321637486572232180L;
private final int code;
- private final long streamId;
- public H2StreamException(final H2Error error, final long streamId, final String message) {
+ public H2StreamResetException(final H2Error error, final String message) {
super(message);
Args.notNull(error, "H2 Error code may not be null");
- Args.positive(streamId, "H2 stream id may not be negative or zero");
this.code = error.getCode();
- this.streamId = streamId;
}
- public H2StreamException(final int code, final long streamId, final String message) {
+ public H2StreamResetException(final int code, final String message) {
super(message);
- Args.positive(streamId, "H2 stream id may not be negative or zero");
this.code = code;
- this.streamId = streamId;
}
public int getCode() {
return code;
}
- public long getStreamId() {
- return streamId;
- }
-
};
Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java?rev=1761318&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java Sun Sep 18 11:29:30 2016
@@ -0,0 +1,174 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http2.config;
+
+import org.apache.hc.core5.annotation.Contract;
+import org.apache.hc.core5.annotation.ThreadingBehavior;
+import org.apache.hc.core5.http2.frame.FrameConsts;
+import org.apache.hc.core5.util.Args;
+
+/**
+ * HTTP/2 protocol configuration.
+ *
+ * @since 5.0
+ */
+@Contract(threading = ThreadingBehavior.IMMUTABLE)
+public class H2Config {
+
+ public static final H2Config DEFAULT = new Builder().build();
+
+ private final int headerTableSize;
+ private final boolean pushEnabled;
+ private final int maxConcurrentStreams;
+ private final int initialWindowSize;
+ private final int maxFrameSize;
+ private final int maxHeaderListSize;
+
+ H2Config(final int headerTableSize, final boolean pushEnabled, final int maxConcurrentStreams,
+ final int initialWindowSize, final int maxFrameSize, final int maxHeaderListSize) {
+ super();
+ this.headerTableSize = headerTableSize;
+ this.pushEnabled = pushEnabled;
+ this.maxConcurrentStreams = maxConcurrentStreams;
+ this.initialWindowSize = initialWindowSize;
+ this.maxFrameSize = maxFrameSize;
+ this.maxHeaderListSize = maxHeaderListSize;
+ }
+
+ public int getHeaderTableSize() {
+ return headerTableSize;
+ }
+
+ public boolean isPushEnabled() {
+ return pushEnabled;
+ }
+
+ public int getMaxConcurrentStreams() {
+ return maxConcurrentStreams;
+ }
+
+ public int getInitialWindowSize() {
+ return initialWindowSize;
+ }
+
+ public int getMaxFrameSize() {
+ return maxFrameSize;
+ }
+
+ public int getMaxHeaderListSize() {
+ return maxHeaderListSize;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("[headerTableSize=").append(this.headerTableSize)
+ .append(", pushEnabled=").append(this.pushEnabled)
+ .append(", maxConcurrentStreams=").append(this.maxConcurrentStreams)
+ .append(", initialWindowSize=").append(this.initialWindowSize)
+ .append(", maxFrameSize=").append(this.maxFrameSize)
+ .append(", maxHeaderListSize=").append(this.maxHeaderListSize)
+ .append("]");
+ return builder.toString();
+ }
+
+ public static H2Config.Builder custom() {
+ return new Builder();
+ }
+
+ public static H2Config.Builder copy(final H2Config config) {
+ Args.notNull(config, "Connection config");
+ return new Builder()
+ .setHeaderTableSize(config.getHeaderTableSize())
+ .setPushEnabled(config.isPushEnabled())
+ .setMaxConcurrentStreams(config.getMaxConcurrentStreams())
+ .setInitialWindowSize(config.getInitialWindowSize())
+ .setMaxFrameSize(config.getMaxFrameSize())
+ .setMaxHeaderListSize(config.getMaxHeaderListSize());
+ }
+
+ public static class Builder {
+
+ private int headerTableSize;
+ private boolean pushEnabled;
+ private int maxConcurrentStreams;
+ private int initialWindowSize;
+ private int maxFrameSize;
+ private int maxHeaderListSize;
+
+ Builder() {
+ this.headerTableSize = 8192;
+ this.pushEnabled = false;
+ this.maxConcurrentStreams = 100;
+ this.initialWindowSize = 65535;
+ this.maxFrameSize = FrameConsts.MIN_FRAME_SIZE * 4;
+ this.maxHeaderListSize = FrameConsts.MAX_FRAME_SIZE;
+ }
+
+ public Builder setHeaderTableSize(final int headerTableSize) {
+ Args.notNegative(headerTableSize, "Header table size");
+ this.headerTableSize = headerTableSize;
+ return this;
+ }
+
+ public Builder setPushEnabled(final boolean pushEnabled) {
+ this.pushEnabled = pushEnabled;
+ return this;
+ }
+
+ public Builder setMaxConcurrentStreams(final int maxConcurrentStreams) {
+ Args.positive(maxConcurrentStreams, "Max concurrent streams");
+ this.maxConcurrentStreams = maxConcurrentStreams;
+ return this;
+ }
+
+ public Builder setInitialWindowSize(final int initialWindowSize) {
+ this.initialWindowSize = initialWindowSize;
+ return this;
+ }
+
+ public Builder setMaxFrameSize(final int maxFrameSize) {
+ Args.check(maxFrameSize >= FrameConsts.MIN_FRAME_SIZE && maxFrameSize < FrameConsts.MAX_FRAME_SIZE, "Invalid max frame size");
+ this.maxFrameSize = maxFrameSize;
+ return this;
+ }
+
+ public Builder setMaxHeaderListSize(final int maxHeaderListSize) {
+ Args.positive(maxHeaderListSize, "Max header list size");
+ this.maxHeaderListSize = maxHeaderListSize;
+ return this;
+ }
+
+ public H2Config build() {
+ return new H2Config(
+ headerTableSize, pushEnabled, maxConcurrentStreams, initialWindowSize, maxFrameSize, maxHeaderListSize);
+ }
+
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Config.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java (from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Param.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java?p2=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Param.java&r1=1761317&r2=1761318&rev=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Param.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java Sun Sep 18 11:29:30 2016
@@ -24,34 +24,27 @@
* <http://www.apache.org/>.
*
*/
-package org.apache.hc.core5.http2.frame;
+package org.apache.hc.core5.http2.config;
public enum H2Param {
- HEADER_TABLE_SIZE (0x1, 4096),
- ENABLE_PUSH (0x2, 1),
- MAX_CONCURRENT_STREAMS (0x3, Integer.MAX_VALUE),
- INITIAL_WINDOW_SIZE (0x4, 65535),
- MAX_FRAME_SIZE (0x5, 16384),
- MAX_HEADER_LIST_SIZE (0x6, Integer.MAX_VALUE);
+ HEADER_TABLE_SIZE (0x1),
+ ENABLE_PUSH (0x2),
+ MAX_CONCURRENT_STREAMS (0x3),
+ INITIAL_WINDOW_SIZE (0x4),
+ MAX_FRAME_SIZE (0x5),
+ MAX_HEADER_LIST_SIZE (0x6);
int code;
- int initialValue;
-
- H2Param(final int code, final int initialValue) {
+ H2Param(final int code) {
this.code = code;
- this.initialValue = initialValue;
}
public int getCode() {
return code;
}
- public int getInitialValue() {
- return initialValue;
- }
-
private static final H2Param[] LOOKUP_TABLE = new H2Param[6];
static {
for (H2Param param: H2Param.values()) {
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Param.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java (from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java?p2=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java&r1=1761317&r2=1761318&rev=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/H2Setting.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/config/H2Setting.java Sun Sep 18 11:29:30 2016
@@ -24,7 +24,7 @@
* <http://www.apache.org/>.
*
*/
-package org.apache.hc.core5.http2.frame;
+package org.apache.hc.core5.http2.config;
import org.apache.hc.core5.util.Args;
@@ -40,12 +40,6 @@ public final class H2Setting {
this.value = value;
}
- public H2Setting(final H2Param param) {
- Args.notNull(param, "Setting parameter");
- this.param = param;
- this.value = param.initialValue;
- }
-
public int getCode() {
return param.code;
}
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/DefaultFrameFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/DefaultFrameFactory.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/DefaultFrameFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/DefaultFrameFactory.java Sun Sep 18 11:29:30 2016
@@ -47,6 +47,13 @@ public class DefaultFrameFactory extends
return new RawFrame(FrameType.CONTINUATION.getValue(), flags, streamId, payload);
}
+ @Override
+ public RawFrame createPushPromise(final int streamId, final ByteBuffer payload, final boolean endHeaders) {
+ Args.positive(streamId, "Stream id");
+ final int flags = (endHeaders ? FrameFlag.END_HEADERS.value : 0);
+ return new RawFrame(FrameType.PUSH_PROMISE.getValue(), flags, streamId, payload);
+ }
+
public RawFrame createData(final int streamId, final ByteBuffer payload, final boolean endStream) {
Args.positive(streamId, "Stream id");
final int flags = (endStream ? FrameFlag.END_STREAM.value : 0);
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameConsts.java Sun Sep 18 11:29:30 2016
@@ -34,7 +34,7 @@ public final class FrameConsts {
public final static int HEAD_LEN = 9;
public final static int MAX_PADDING = 255;
- public final static int MIN_FRAME_SIZE = 2 ^ 14;
- public final static int MAX_FRAME_SIZE = 2 ^ 24 - 1;
+ public final static int MIN_FRAME_SIZE = 16384; // 2 ^ 14
+ public final static int MAX_FRAME_SIZE = 16777215; // 2 ^ 24 - 1;
};
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFactory.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFactory.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FrameFactory.java Sun Sep 18 11:29:30 2016
@@ -31,20 +31,11 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http2.H2Error;
+import org.apache.hc.core5.http2.config.H2Setting;
import org.apache.hc.core5.util.Args;
public abstract class FrameFactory {
- // PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n
- private final static byte[] PREFACE = new byte[] {
- 0x50, 0x52, 0x49, 0x20, 0x2a, 0x20, 0x48, 0x54, 0x54, 0x50,
- 0x2f, 0x32, 0x2e, 0x30, 0x0d, 0x0a, 0x0d, 0x0a, 0x53, 0x4d,
- 0x0d, 0x0a, 0x0d, 0x0a};
-
- public byte[] createConnectionPreface() {
- return PREFACE;
- }
-
public RawFrame createSettings(final H2Setting... settings) {
final ByteBuffer payload = ByteBuffer.allocate(settings.length * 12);
for (H2Setting setting: settings) {
@@ -60,10 +51,14 @@ public abstract class FrameFactory {
}
public RawFrame createResetStream(final int streamId, final H2Error error) {
- Args.positive(streamId, "Stream id");
Args.notNull(error, "Error");
+ return createResetStream(streamId, error.getCode());
+ }
+
+ public RawFrame createResetStream(final int streamId, final int code) {
+ Args.positive(streamId, "Stream id");
final ByteBuffer payload = ByteBuffer.allocate(4);
- payload.putInt(error.getCode());
+ payload.putInt(code);
payload.flip();
return new RawFrame(FrameType.RST_STREAM.getValue(), 0, streamId, payload);
}
@@ -81,12 +76,14 @@ public abstract class FrameFactory {
}
public RawFrame createGoAway(final int lastStream, final H2Error error, final String message) {
- Args.positive(lastStream, "Last stream id");
+ Args.notNegative(lastStream, "Last stream id");
final byte[] debugData = message != null ? message.getBytes(StandardCharsets.US_ASCII) : null;
final ByteBuffer payload = ByteBuffer.allocate(8 + (debugData != null ? debugData.length : 0));
payload.putInt(lastStream);
payload.putInt(error.getCode());
- payload.put(debugData);
+ if (debugData != null) {
+ payload.put(debugData);
+ }
payload.flip();
return new RawFrame(FrameType.GOAWAY.getValue(), 0, 0, payload);
}
@@ -95,6 +92,17 @@ public abstract class FrameFactory {
public abstract RawFrame createContinuation(int streamId, ByteBuffer payload, boolean endHeaders);
+ public abstract RawFrame createPushPromise(int streamId, ByteBuffer payload, boolean endHeaders);
+
public abstract RawFrame createData(int streamId, ByteBuffer payload, boolean endStream);
+ public RawFrame createWindowUpdate(final int streamId, final int increment) {
+ Args.notNegative(streamId, "Stream id");
+ Args.positive(increment, "Increment");
+ final ByteBuffer payload = ByteBuffer.allocate(4);
+ payload.putInt(increment);
+ payload.flip();
+ return new RawFrame(FrameType.WINDOW_UPDATE.getValue(), 0, streamId, payload);
+ }
+
}
Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java?rev=1761318&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java Sun Sep 18 11:29:30 2016
@@ -0,0 +1,209 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http2.frame;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+
+import org.apache.hc.core5.http2.H2Error;
+import org.apache.hc.core5.http2.config.H2Param;
+
+/**
+ * @since 5.0
+ */
+public final class FramePrinter {
+
+ public void printFrameInfo(final RawFrame frame, final Appendable appendable) throws IOException {
+ appendable.append("stream ").append(Integer.toString(frame.getStreamId())).append(" frame: ");
+ final FrameType type = FrameType.valueOf(frame.getType());
+ appendable.append(Objects.toString(type))
+ .append(" (0x").append(Integer.toHexString(frame.getType())).append("); flags: ");
+ final int flags = frame.getFlags();
+ if (flags > 0) {
+ switch (type) {
+ case SETTINGS:
+ case PING:
+ if ((flags & FrameFlag.ACK.value) > 0) {
+ appendable.append(FrameFlag.ACK.name()).append(" ");
+ }
+ break;
+ case DATA:
+ if ((flags & FrameFlag.END_STREAM.value) > 0) {
+ appendable.append(FrameFlag.END_STREAM.name()).append(" ");
+ }
+ if ((flags & FrameFlag.PADDED.value) > 0) {
+ appendable.append(FrameFlag.PADDED.name()).append(" ");
+ }
+ break;
+ case HEADERS:
+ if ((flags & FrameFlag.END_STREAM.value) > 0) {
+ appendable.append(FrameFlag.END_STREAM.name()).append(" ");
+ }
+ if ((flags & FrameFlag.END_HEADERS.value) > 0) {
+ appendable.append(FrameFlag.END_HEADERS.name()).append(" ");
+ }
+ if ((flags & FrameFlag.PADDED.value) > 0) {
+ appendable.append(FrameFlag.PADDED.name()).append(" ");
+ }
+ if ((flags & FrameFlag.PRIORITY.value) > 0) {
+ appendable.append(FrameFlag.PRIORITY.name()).append(" ");
+ }
+ break;
+ case PUSH_PROMISE:
+ if ((flags & FrameFlag.END_HEADERS.value) > 0) {
+ appendable.append(FrameFlag.END_HEADERS.name()).append(" ");
+ }
+ if ((flags & FrameFlag.PADDED.value) > 0) {
+ appendable.append(FrameFlag.PADDED.name()).append(" ");
+ }
+ break;
+ case CONTINUATION:
+ if ((flags & FrameFlag.END_HEADERS.value) > 0) {
+ appendable.append(FrameFlag.END_HEADERS.name()).append(" ");
+ }
+ }
+ }
+ appendable.append("(0x").append(Integer.toHexString(flags)).append("); length: ").append(Integer.toString(frame.getLength()));
+ }
+
+ public void printPayload(final RawFrame frame, final Appendable appendable) throws IOException {
+
+ final FrameType type = FrameType.valueOf(frame.getType());
+ final ByteBuffer buf = frame.getPayloadContent();
+ if (buf != null) {
+
+ switch (type) {
+ case SETTINGS:
+ if ((buf.remaining() % 6) == 0) {
+ while (buf.hasRemaining()) {
+ final int code = buf.getShort();
+ final H2Param param = H2Param.valueOf(code);
+ final int value = buf.getInt();
+ if (param != null) {
+ appendable.append(param.name());
+ } else {
+ appendable.append("0x").append(Integer.toHexString(code));
+ }
+ appendable.append(": ").append(Integer.toString(value)).append("\r\n");
+ }
+ } else {
+ appendable.append("Invalid\r\n");
+ }
+ break;
+ case RST_STREAM:
+ if (buf.remaining() == 4) {
+ appendable.append("Code ");
+ final int code = buf.getInt();
+ final H2Error error = H2Error.getByCode(code);
+ if (error != null) {
+ appendable.append(error.name());
+ } else {
+ appendable.append("0x").append(Integer.toHexString(code));
+ }
+ appendable.append("\r\n");
+ } else {
+ appendable.append("Invalid\r\n");
+ }
+ break;
+ case GOAWAY:
+ if (buf.remaining() >= 8) {
+ final int lastStream = buf.getInt();
+ appendable.append("Last stream ").append(Integer.toString(lastStream)).append("\r\n");
+ appendable.append("Code ");
+ final int code2 = buf.getInt();
+ final H2Error error2 = H2Error.getByCode(code2);
+ if (error2 != null) {
+ appendable.append(error2.name());
+ } else {
+ appendable.append("0x").append(Integer.toHexString(code2));
+ }
+ appendable.append("\r\n");
+ final byte[] tmp = new byte[buf.remaining()];
+ buf.get(tmp);
+ appendable.append(new String(tmp, StandardCharsets.US_ASCII));
+ appendable.append("\r\n");
+ } else {
+ appendable.append("Invalid\r\n");
+ }
+ break;
+ case WINDOW_UPDATE:
+ if (buf.remaining() == 4) {
+ final int increment = buf.getInt();
+ appendable.append("Increment ").append(Integer.toString(increment)).append("\r\n");
+ } else {
+ appendable.append("Invalid\r\n");
+ }
+ break;
+ case PUSH_PROMISE:
+ if (buf.remaining() > 4) {
+ final int streamId = buf.getInt();
+ appendable.append("Promised stream ").append(Integer.toString(streamId)).append("\r\n");
+ printData(buf, appendable);
+ } else {
+ appendable.append("Invalid\r\n");
+ }
+ break;
+ default:
+ printData(frame.getPayload(), appendable);
+ }
+ }
+ }
+
+ public void printData(final ByteBuffer data, final Appendable appendable) throws IOException {
+ final ByteBuffer buf = data.duplicate();
+ final byte[] line = new byte[16];
+ while (buf.hasRemaining()) {
+ final int chunk = Math.min(buf.remaining(), line.length);
+ buf.get(line, 0, chunk);
+
+ for (int i = 0; i < chunk; i++) {
+ final char ch = (char) line[i];
+ if (ch > 32 && ch < 128) {
+ appendable.append(ch);
+ } else if (Character.isWhitespace(ch)) {
+ appendable.append(' ');
+ } else {
+ appendable.append('.');
+ }
+ }
+ for (int i = chunk; i < 17; i++) {
+ appendable.append(' ');
+ }
+
+ for (int i = 0; i < chunk; i++) {
+ appendable.append(' ');
+ final int b = line[i] & 0xff;
+ appendable.append(Integer.toHexString(b));
+ }
+ appendable.append("\r\n");
+ }
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/FramePrinter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java Sun Sep 18 11:29:30 2016
@@ -28,13 +28,20 @@ package org.apache.hc.core5.http2.frame;
import java.nio.ByteBuffer;
+/**
+ * HTTP/2 stream frame.
+ *
+ * @since 5.0
+ */
public final class RawFrame extends Frame<ByteBuffer> {
private final ByteBuffer payload;
+ private final int len;
public RawFrame(final int type, final int flags, final int streamId, final ByteBuffer payload) {
super(type, flags, streamId);
this.payload = payload;
+ this.len = payload != null ? payload.remaining() : 0;
}
public boolean isPadded() {
@@ -42,7 +49,7 @@ public final class RawFrame extends Fram
}
public int getLength() {
- return payload != null ? payload.remaining() : 0;
+ return len;
}
public ByteBuffer getPayloadContent() {
Copied: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/StreamIdGenerator.java (from r1761317, httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/StreamIdGenerator.java?p2=httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/StreamIdGenerator.java&p1=httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java&r1=1761317&r2=1761318&rev=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/StreamIdGenerator.java Sun Sep 18 11:29:30 2016
@@ -24,33 +24,54 @@
* <http://www.apache.org/>.
*
*/
+
package org.apache.hc.core5.http2.frame;
-import org.junit.Assert;
-import org.junit.Test;
+/**
+ * HTTP/2 steam ID generator.
+ *
+ * @since 5.0
+ */
+public interface StreamIdGenerator {
+
+ int generate(int previousMax);
+
+ boolean isSameSide(int streamId);
+
+ StreamIdGenerator ODD = new StreamIdGenerator() {
+
+ @Override
+ public int generate(final int previousMax) {
+ int i = previousMax + 1;
+ if (i % 2 == 0) {
+ i++;
+ }
+ return i;
+ }
+
+ @Override
+ public boolean isSameSide(final int streamId) {
+ return (streamId & 1) == 1;
+ }
+
+ };
-public class TestH2Settings {
+ StreamIdGenerator EVEN = new StreamIdGenerator() {
- @Test
- public void testH2ParamBasics() throws Exception {
- for (H2Param param: H2Param.values()) {
- Assert.assertEquals(param, H2Param.valueOf(param.getCode()));
- Assert.assertEquals(param.name(), H2Param.toString(param.getCode()));
+ @Override
+ public int generate(final int previousMax) {
+ int i = previousMax + 1;
+ if (i % 2 == 1) {
+ i++;
+ }
+ return i;
}
- Assert.assertEquals(null, H2Param.valueOf(0));
- Assert.assertEquals(null, H2Param.valueOf(10));
- Assert.assertEquals("0", H2Param.toString(0));
- Assert.assertEquals("10", H2Param.toString(10));
- }
-
- @Test
- public void testH2SettingBasics() throws Exception {
-
- final H2Setting setting1 = new H2Setting(H2Param.ENABLE_PUSH, 0);
- final H2Setting setting2 = new H2Setting(H2Param.INITIAL_WINDOW_SIZE, 1024);
-
- Assert.assertEquals("ENABLE_PUSH: 0", setting1.toString());
- Assert.assertEquals("INITIAL_WINDOW_SIZE: 1024", setting2.toString());
- }
-};
+ @Override
+ public boolean isSameSide(final int streamId) {
+ return (streamId & 1) == 0;
+ }
+
+ };
+
+}
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackEncoder.java Sun Sep 18 11:29:30 2016
@@ -78,12 +78,12 @@ public final class HPackEncoder {
}
}
- static void encodeHuffman(final ByteArrayBuffer dst, final ByteBuffer src) throws HPackException {
+ static void encodeHuffman(final ByteArrayBuffer dst, final ByteBuffer src) {
Huffman.ENCODER.encode(dst, src);
}
- void encodeString(final ByteArrayBuffer dst, final ByteBuffer src, final boolean huffman) throws HPackException {
+ void encodeString(final ByteArrayBuffer dst, final ByteBuffer src, final boolean huffman) {
final int strLen = src.remaining();
if (huffman) {
@@ -141,7 +141,7 @@ public final class HPackEncoder {
int encodeString(
final ByteArrayBuffer dst,
final CharSequence charSequence, final int off, final int len,
- final boolean huffman) throws HPackException, CharacterCodingException {
+ final boolean huffman) throws CharacterCodingException {
clearState();
if (this.charsetEncoder == null) {
@@ -181,20 +181,20 @@ public final class HPackEncoder {
}
}
- int encodeString(final ByteArrayBuffer dst, final String s, final boolean huffman) throws HPackException, CharacterCodingException {
+ int encodeString(final ByteArrayBuffer dst, final String s, final boolean huffman) throws CharacterCodingException {
return encodeString(dst, s, 0, s.length(), huffman);
}
void encodeLiteralHeader(
final ByteArrayBuffer dst, final HPackEntry existing, final Header header,
- final HPackRepresentation representation, final boolean useHuffman) throws CharacterCodingException, HPackException {
+ final HPackRepresentation representation, final boolean useHuffman) throws CharacterCodingException {
encodeLiteralHeader(dst, existing, header.getName(), header.getValue(), header.isSensitive(), representation, useHuffman);
}
void encodeLiteralHeader(
final ByteArrayBuffer dst, final HPackEntry existing, final String key, final String value, final boolean sensitive,
- final HPackRepresentation representation, final boolean useHuffman) throws CharacterCodingException, HPackException {
+ final HPackRepresentation representation, final boolean useHuffman) throws CharacterCodingException {
final int n;
final int mask;
@@ -229,7 +229,7 @@ public final class HPackEncoder {
}
}
- void encodeIndex(final ByteArrayBuffer dst, final int index) throws HPackException {
+ void encodeIndex(final ByteArrayBuffer dst, final int index) {
encodeInt(dst, 7, index, 0x80);
}
@@ -248,13 +248,13 @@ public final class HPackEncoder {
void encodeHeader(
final ByteArrayBuffer dst, final Header header,
- final boolean noIndexing, final boolean useHuffman) throws CharacterCodingException, HPackException {
+ final boolean noIndexing, final boolean useHuffman) throws CharacterCodingException {
encodeHeader(dst, header.getName(), header.getValue(), header.isSensitive(), noIndexing, useHuffman);
}
void encodeHeader(
final ByteArrayBuffer dst, final String name, final String value, final boolean sensitive,
- final boolean noIndexing, final boolean useHuffman) throws CharacterCodingException, HPackException {
+ final boolean noIndexing, final boolean useHuffman) throws CharacterCodingException {
final HPackRepresentation representation;
if (sensitive) {
@@ -296,36 +296,28 @@ public final class HPackEncoder {
void encodeHeaders(
final ByteArrayBuffer dst, final List<Header> headers,
- final boolean noIndexing, final boolean useHuffman) throws HPackException {
+ final boolean noIndexing, final boolean useHuffman) throws CharacterCodingException {
for (int i = 0; i < headers.size(); i++) {
- try {
- encodeHeader(dst, headers.get(i), noIndexing, useHuffman);
- } catch (CharacterCodingException ex) {
- throw new HPackException(ex.getMessage(), ex);
- }
+ encodeHeader(dst, headers.get(i), noIndexing, useHuffman);
}
}
public void encodeHeader(
- final ByteArrayBuffer dst, final Header header) throws HPackException {
+ final ByteArrayBuffer dst, final Header header) throws CharacterCodingException {
Args.notNull(dst, "ByteArrayBuffer");
Args.notNull(header, "Header");
encodeHeader(dst, header.getName(), header.getValue(), header.isSensitive());
}
public void encodeHeader(
- final ByteArrayBuffer dst, final String name, final String value, final boolean sensitive) throws HPackException {
+ final ByteArrayBuffer dst, final String name, final String value, final boolean sensitive) throws CharacterCodingException {
Args.notNull(dst, "ByteArrayBuffer");
Args.notEmpty(name, "Header name");
- try {
- encodeHeader(dst, name, value, sensitive, false, true);
- } catch (CharacterCodingException ex) {
- throw new HPackException(ex.getMessage(), ex);
- }
+ encodeHeader(dst, name, value, sensitive, false, true);
}
public void encodeHeaders(
- final ByteArrayBuffer dst, final List<Header> headers) throws HPackException {
+ final ByteArrayBuffer dst, final List<Header> headers) throws CharacterCodingException {
Args.notNull(dst, "ByteArrayBuffer");
Args.notEmpty(headers, "Header list");
encodeHeaders(dst, headers, false, true);
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HuffmanEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HuffmanEncoder.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HuffmanEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HuffmanEncoder.java Sun Sep 18 11:29:30 2016
@@ -45,7 +45,7 @@ final class HuffmanEncoder {
this.lengths = lengths;
}
- void encode(final ByteArrayBuffer out, final ByteBuffer src) throws HPackException {
+ void encode(final ByteArrayBuffer out, final ByteBuffer src) {
long current = 0;
int n = 0;
@@ -72,7 +72,7 @@ final class HuffmanEncoder {
}
}
- void encode(final ByteArrayBuffer out, final CharSequence src, final int off, final int len) throws HPackException {
+ void encode(final ByteArrayBuffer out, final CharSequence src, final int off, final int len) {
long current = 0;
int n = 0;
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2RequestConverter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2RequestConverter.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2RequestConverter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2RequestConverter.java Sun Sep 18 11:29:30 2016
@@ -30,6 +30,7 @@ package org.apache.hc.core5.http2.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
@@ -173,13 +174,14 @@ public final class DefaultH2RequestConve
for (final Iterator<Header> it = message.headerIterator(); it.hasNext(); ) {
final Header header = it.next();
final String name = header.getName();
+ final String value = header.getValue();
if (name.startsWith(":")) {
throw new ProtocolException("Header name '" + name + "' is invalid");
}
if (name.equalsIgnoreCase(HttpHeaders.CONNECTION)) {
- throw new ProtocolException("Header '" + header.getName() + ": " + header.getValue() + "' is illegal for HTTP/2 messages");
+ throw new ProtocolException("Header '" + name + ": " + value + "' is illegal for HTTP/2 messages");
}
- headers.add(header);
+ headers.add(new BasicHeader(name.toLowerCase(Locale.ROOT), value));
}
return headers;
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2ResponseConverter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2ResponseConverter.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2ResponseConverter.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/DefaultH2ResponseConverter.java Sun Sep 18 11:29:30 2016
@@ -30,6 +30,7 @@ package org.apache.hc.core5.http2.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpException;
@@ -118,13 +119,14 @@ public class DefaultH2ResponseConverter
for (final Iterator<Header> it = message.headerIterator(); it.hasNext(); ) {
final Header header = it.next();
final String name = header.getName();
+ final String value = header.getValue();
if (name.startsWith(":")) {
throw new ProtocolException("Header name '" + name + "' is invalid");
}
if (name.equalsIgnoreCase(HttpHeaders.CONNECTION)) {
- throw new ProtocolException("Header '" + header.getName() + ": " + header.getValue() + "' is illegal for HTTP/2 messages");
+ throw new ProtocolException("Header '" + name + ": " + value + "' is illegal for HTTP/2 messages");
}
- headers.add(header);
+ headers.add(new BasicHeader(name.toLowerCase(Locale.ROOT), value));
}
return headers;
}
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameInputBuffer.java Sun Sep 18 11:29:30 2016
@@ -35,11 +35,11 @@ import org.apache.hc.core5.http.Connecti
import org.apache.hc.core5.http2.H2ConnectionException;
import org.apache.hc.core5.http2.H2CorruptFrameException;
import org.apache.hc.core5.http2.H2Error;
+import org.apache.hc.core5.http2.H2TransportMetrics;
import org.apache.hc.core5.http2.frame.FrameConsts;
import org.apache.hc.core5.http2.frame.FrameFlag;
import org.apache.hc.core5.http2.frame.RawFrame;
import org.apache.hc.core5.http2.impl.BasicH2TransportMetrics;
-import org.apache.hc.core5.http2.H2TransportMetrics;
import org.apache.hc.core5.util.Args;
/**
Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java?rev=1761318&r1=1761317&r2=1761318&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/io/FrameOutputBuffer.java Sun Sep 18 11:29:30 2016
@@ -33,11 +33,11 @@ import java.nio.ByteBuffer;
import org.apache.hc.core5.http2.H2ConnectionException;
import org.apache.hc.core5.http2.H2Error;
+import org.apache.hc.core5.http2.H2TransportMetrics;
import org.apache.hc.core5.http2.frame.FrameConsts;
import org.apache.hc.core5.http2.frame.FrameFlag;
import org.apache.hc.core5.http2.frame.RawFrame;
import org.apache.hc.core5.http2.impl.BasicH2TransportMetrics;
-import org.apache.hc.core5.http2.H2TransportMetrics;
import org.apache.hc.core5.util.Args;
/**
Added: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java?rev=1761318&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java (added)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java Sun Sep 18 11:29:30 2016
@@ -0,0 +1,100 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.hc.core5.http2.impl.nio;
+
+import org.apache.hc.core5.reactor.IOEventHandler;
+import org.apache.hc.core5.reactor.IOSession;
+import org.apache.hc.core5.util.Args;
+
+class AbstractHttp2IOEventHandler implements IOEventHandler {
+
+ private final AbstractHttp2StreamMultiplexer streamMultiplexer;
+ private final HttpErrorListener errorListener;
+
+ AbstractHttp2IOEventHandler(final AbstractHttp2StreamMultiplexer streamMultiplexer, final HttpErrorListener errorListener) {
+ this.streamMultiplexer = Args.notNull(streamMultiplexer, "Stream multiplexer");
+ this.errorListener = errorListener;
+ }
+
+ @Override
+ public void connected(final IOSession session) {
+ try {
+ streamMultiplexer.onConnect(null);
+ } catch (final Exception ex) {
+ streamMultiplexer.onException(ex);
+ if (errorListener != null) {
+ errorListener.onError(ex);
+ }
+ }
+ }
+
+ @Override
+ public void inputReady(final IOSession session) {
+ try {
+ streamMultiplexer.onInput();
+ } catch (final Exception ex) {
+ streamMultiplexer.onException(ex);
+ if (errorListener != null) {
+ errorListener.onError(ex);
+ }
+ }
+ }
+
+ @Override
+ public void outputReady(final IOSession session) {
+ try {
+ streamMultiplexer.onOutput();
+ } catch (final Exception ex) {
+ streamMultiplexer.onException(ex);
+ if (errorListener != null) {
+ errorListener.onError(ex);
+ }
+ }
+ }
+
+ @Override
+ public void timeout(final IOSession session) {
+ try {
+ streamMultiplexer.onTimeout();
+ } catch (final Exception ex) {
+ streamMultiplexer.onException(ex);
+ if (errorListener != null) {
+ errorListener.onError(ex);
+ }
+ }
+ }
+
+ @Override
+ public void disconnected(final IOSession session) {
+ }
+
+ public void requestGracefulShutdown() {
+ streamMultiplexer.requestGracefulShutdown();
+ }
+
+}
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractHttp2IOEventHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain