netty5/codec-http/src/main/java/io/netty/handler/codec/http/multipart
Dmitry Minkovsky 8aeba78ecc HttpPostMultipartRequestDecoder should decode header field parameters
Motivation:

I am receiving a multipart/form_data upload from a Mailgun webhook. This webhook used to send parts like this:

--74e78d11b0214bdcbc2f86491eeb4902
Content-Disposition: form-data; name="attachment-2"; filename="attached_�айл.txt"
Content-Type: text/plain
Content-Length: 32

This is the content of the file

--74e78d11b0214bdcbc2f86491eeb4902--
but now it posts parts like this:

--74e78d11b0214bdcbc2f86491eeb4902
Content-Disposition: form-data; name="attachment-2"; filename*=utf-8''attached_%D1%84%D0%B0%D0%B9%D0%BB.txt

This is the content of the file

--74e78d11b0214bdcbc2f86491eeb4902--
This new format uses field parameter encoding described in RFC 5987. More about this encoding can be found here.

Netty does not parse this format. The result is the filename is not decoded and the part is not parsed into a FileUpload.

Modification:

Added failing test in HttpPostRequestDecoderTest.java and updated HttpPostMultipartRequestDecoder.java
Refactored to please Netkins
Result:

Fixes:

HttpPostMultipartRequestDecoder identifies the RFC 5987 format and parses it.
Previous functionality is retained.
2017-10-24 19:30:59 +02:00
..
AbstractDiskHttpData.java Possible leak in AbstractDiskHttpData 2015-02-03 20:10:45 +01:00
AbstractHttpData.java Get uploaded size while upload is in progress 2015-06-12 14:16:07 +02:00
AbstractMemoryHttpData.java Add CompositeByteBuf.addComponent(boolean ...) method to simplify usage 2016-05-21 19:52:16 +02:00
Attribute.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
CaseIgnoringComparator.java Fix most inspector warnings 2014-07-02 19:55:07 +09:00
DefaultHttpDataFactory.java Get uploaded size while upload is in progress 2015-06-12 14:16:07 +02:00
DiskAttribute.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
DiskFileUpload.java Use constant string instead of user provided file name for DiskFileUpload temp file names. 2017-04-27 16:02:41 -07:00
FileUpload.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
FileUploadUtil.java [#5514] Fix DiskFileUpload and MemoryFileUpload equals(...) method. 2016-07-14 09:09:16 +02:00
HttpData.java Fix javadoc issues 2017-02-22 07:31:07 +01:00
HttpDataFactory.java Get uploaded size while upload is in progress 2015-06-12 14:16:07 +02:00
HttpPostBodyUtil.java Removing a SeekAheadNoBackArrayException to avoid exception handling 2017-06-06 19:30:04 -07:00
HttpPostMultipartRequestDecoder.java HttpPostMultipartRequestDecoder should decode header field parameters 2017-10-24 19:30:59 +02:00
HttpPostRequestDecoder.java Improvement : allocate less object during multipart form parsing. 2017-04-25 14:06:10 +02:00
HttpPostRequestEncoder.java Fix NPEs in HttpPostRequestEncoder#nextChunk 2017-07-19 14:35:51 +02:00
HttpPostStandardRequestDecoder.java Removing a SeekAheadNoBackArrayException to avoid exception handling 2017-06-06 19:30:04 -07:00
InterfaceHttpData.java Enable a user specify an arbitrary information with ReferenceCounted.touch() 2014-02-13 18:16:25 -08:00
InterfaceHttpPostRequestDecoder.java Extends HttpPostRequestEncoder to support all methods except TRACE 2016-12-30 12:00:21 -08:00
InternalAttribute.java Fix InternalAttribute.equals 2016-01-11 09:25:17 +01:00
MemoryAttribute.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
MemoryFileUpload.java [#5514] Fix DiskFileUpload and MemoryFileUpload equals(...) method. 2016-07-14 09:09:16 +02:00
MixedAttribute.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
MixedFileUpload.java Make retained derived buffers recyclable 2016-05-17 11:16:13 +02:00
package-info.java Port http multipart package. See #709 2012-11-04 13:59:50 +01:00