netty5/codec-http/src/main/java/io/netty/handler/codec/http
Nick Hill 2ca526fac6 Ensure "full" ownership of msgs passed to EmbeddedChannel.writeInbound() (#9058)
Motivation

Pipeline handlers are free to "take control" of input buffers if they have singular refcount - in particular to mutate their raw data if non-readonly via discarding of read bytes, etc.

However there are various places (primarily unit tests) where a wrapped byte-array buffer is passed in and the wrapped array is assumed not to change (used after the wrapped buffer is passed to EmbeddedChannel.writeInbound()). This invalid assumption could result in unexpected errors, such as those exposed by #8931.

Modifications

Anywhere that the data passed to writeInbound() might be used again, ensure that either:
- A copy is used rather than wrapping a shared byte array, or
- The buffer is otherwise protected from modification by making it read-only

For the tests, copying is preferred since it still allows the "mutating" optimizations to be exercised.

Results

Avoid possible errors when pipeline assumes it has full control of input buffer.
2019-05-22 12:08:49 +02:00
..
cookie Avoid unnecessary char casts for CookieEncoder (#8827) 2019-02-25 19:50:19 +01:00
cors Compare HttpMethod by reference (#8815) 2019-01-30 21:17:00 +01:00
multipart use checkPositive/checkPositiveOrZero (#8835) 2019-02-04 16:01:49 +01:00
websocketx Ensure "full" ownership of msgs passed to EmbeddedChannel.writeInbound() (#9058) 2019-05-22 12:08:49 +02:00
ClientCookieEncoder.java Fix javadoc issues 2017-02-22 07:31:07 +01:00
CombinedHttpHeaders.java Update to new checkstyle plugin (#8777) (#8780) 2019-01-25 11:58:42 +01:00
ComposedLastHttpContent.java Set result for decoded request and add test for #8721 (#8721) 2019-01-21 07:45:03 +01:00
Cookie.java Deprecation cleanup for HTTP headers 2015-09-09 14:30:21 -07:00
CookieDecoder.java Clean up following #6016 2016-11-21 12:35:40 -08:00
CookieUtil.java Validate cookie name and value characters Motivation: 2015-05-07 06:33:36 +02:00
DefaultCookie.java Validate cookie name and value characters Motivation: 2015-05-07 06:33:36 +02:00
DefaultFullHttpRequest.java Only enable validation of headers if original headers were validating as well. 2017-12-21 07:32:29 +01:00
DefaultFullHttpResponse.java Only enable validation of headers if original headers were validating as well. 2017-12-21 07:32:29 +01:00
DefaultHttpContent.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
DefaultHttpHeaders.java use checkPositive/checkPositiveOrZero (#8835) 2019-02-04 16:01:49 +01:00
DefaultHttpMessage.java Add a possibility to create HttpMessage instances with pre-existing Headers 2015-12-31 08:52:30 +01:00
DefaultHttpObject.java Back port HTTP/2 codec from master to 4.1 2015-01-23 11:06:11 -05:00
DefaultHttpRequest.java Add a possibility to create HttpMessage instances with pre-existing Headers 2015-12-31 08:52:30 +01:00
DefaultHttpResponse.java Correctly take status into account when compare DefaultHttpResponse (#7965) 2018-05-24 20:13:21 +02:00
DefaultLastHttpContent.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
EmptyHttpHeaders.java Move EmptyHttpHeaders.INSTANCE initialization to inner class. 2017-11-17 16:31:09 +01:00
FullHttpMessage.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
FullHttpRequest.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
FullHttpResponse.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
HttpChunkedInput.java Fix possible NPE in HttpCunkedInput if wrapped ChunkedInput.readChunk(...) return null. 2016-06-17 06:27:04 +02:00
HttpClientCodec.java Correctly handle WebSockets 00 when using HttpClientCodec. 2017-11-03 15:55:22 +01:00
HttpClientUpgradeHandler.java Don't replace all 'connection' headers when sending h2c upgrade request (#7824) 2018-04-01 19:59:30 +02:00
HttpConstants.java [#4010] Correctly handle whitespaces in HttpPostMultipartRequestDecoder 2015-08-14 21:16:42 +02:00
HttpContent.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
HttpContentCompressor.java When the response exceeds the threshold, it will be compressed 2018-02-25 16:43:45 +01:00
HttpContentDecoder.java HttpContentDecoder must continue read when it did not produce any mes… (#8922) 2019-03-07 10:31:51 +01:00
HttpContentDecompressor.java Ensure the same ByteBufAllocator is used in the EmbeddedChannel when compress / decompress. Related to [#5294] 2016-05-31 09:08:33 +02:00
HttpContentEncoder.java Compare HttpMethod by reference (#8815) 2019-01-30 21:17:00 +01:00
HttpExpectationFailedEvent.java HttpObjectAggregator doesn't check content-length header 2015-08-17 09:26:50 -07:00
HttpHeaderDateFormat.java Clean up following #6016 2016-11-21 12:35:40 -08:00
HttpHeaderNames.java Immediate caching the strings wrapped to AsciiString 2017-08-15 06:22:14 +02:00
HttpHeaders.java Fix minor spelling issues in javadocs (#8701) 2019-01-14 07:24:34 +01:00
HttpHeadersEncoder.java Use ByteBuf#writeShort/writeMedium instead of writeBytes 2017-07-10 14:37:41 +02:00
HttpHeaderValues.java Immediate caching the strings wrapped to AsciiString 2017-08-15 06:22:14 +02:00
HttpMessage.java Remove 'get' prefix from all HTTP/SPDY messages 2014-06-24 18:03:33 +09:00
HttpMessageUtil.java Implement toString() for all HttpMessage implementations 2014-12-31 18:39:00 +09:00
HttpMethod.java Compare HttpMethod by reference (#8815) 2019-01-30 21:17:00 +01:00
HttpObject.java Introduce MessageAggregator and DecoderResultProvider 2014-06-05 16:51:14 +09:00
HttpObjectAggregator.java Do not manually reset HttpObjectDecoder in HttpObjectAggregator.handleOversizedMessage(...) (#9017) (#9156) 2019-05-17 21:18:03 +02:00
HttpObjectDecoder.java use checkPositive/checkPositiveOrZero (#8835) 2019-02-04 16:01:49 +01:00
HttpObjectEncoder.java Mention the HttpObjectEncoder's state in the message of the IllegalStateException (#7996) 2018-06-04 10:14:58 +02:00
HttpRequest.java Fix errors reported by javadoc 2015-12-27 08:36:45 +01:00
HttpRequestDecoder.java HttpObjectDecoder configurable initial buffer size 2016-02-07 21:23:29 -08:00
HttpRequestEncoder.java Only add / to uri if really needed. 2017-07-18 09:24:19 +02:00
HttpResponse.java Fix errors reported by javadoc 2015-12-27 08:36:45 +01:00
HttpResponseDecoder.java HttpResponseStatus object allocation reduction 2018-01-24 22:01:52 -08:00
HttpResponseEncoder.java Correctly handle responses with status 205 and payload. (#7891) 2018-05-03 11:25:06 +02:00
HttpResponseStatus.java use checkPositive/checkPositiveOrZero (#8835) 2019-02-04 16:01:49 +01:00
HttpScheme.java Immediate caching the strings wrapped to AsciiString 2017-08-15 06:22:14 +02:00
HttpServerCodec.java Compare HttpMethod by reference (#8815) 2019-01-30 21:17:00 +01:00
HttpServerExpectContinueHandler.java Motivation: 2017-04-27 16:20:29 -07:00
HttpServerKeepAliveHandler.java HttpServerKeepAliveHandler doesn't correctly handle VoidChannelPromise 2017-05-04 14:08:18 -07:00
HttpServerUpgradeHandler.java Fix h2c upgrade failure when multiple connection headers are present in upgrade request (#8848) 2019-02-12 08:05:30 -08:00
HttpStatusClass.java Immediate caching the strings wrapped to AsciiString 2017-08-15 06:22:14 +02:00
HttpUtil.java Fix HttpUtil.isKeepAlive to behave correctly when Connection is a comma separated list (#8924) 2019-03-13 14:28:28 +01:00
HttpVersion.java use checkPositive/checkPositiveOrZero (#8835) 2019-02-04 16:01:49 +01:00
LastHttpContent.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
package-info.java Remove apiviz tags - we are focusing on user guide instead and putting diagrams there 2013-02-14 12:09:16 -08:00
QueryStringDecoder.java Added QueryStringDecoder.rawPath() and rawQuery() 2017-10-24 09:32:06 +02:00
QueryStringEncoder.java Optimizations in QueryStringEncoder 2017-06-23 14:03:32 -07:00
ReadOnlyHttpHeaders.java HttpHeaders valuesIterator and contains improvements 2017-11-20 08:34:06 -08:00
ServerCookieEncoder.java Fix ServerCookieEncoder javadoc, close #7115 2017-08-28 20:21:57 +02:00