GitHub user sermojohn opened a pull request:

    https://github.com/apache/httpcomponents-client/pull/85

    HTTPCLIENT-293 Fix proposal based on RFC 7578

    I implemented the fix in two commits, because I believe that some 
refactoring was required in order to handle the part header field parameters 
(name, filename) properly in the Content-Disposition part header field. Also a 
unit test was implemented that fails on the first commit but succeeds on the 
second that includes the actual patch.
    
    I did some research about the percent encoding, which as I can understand 
is quite loose concerning the characters that it should always encode depending 
on the context. The actual percent character encoding implementation was copied 
from the common-codecs' URLCodec but it could not be reused as it was 
implemented, because that class includes URL specific encoding (e.g. ' ' -> '+')

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sermojohn/httpcomponents-client 4.6.x

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/httpcomponents-client/pull/85.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #85
    
----
commit 4fbaa720ab2ee35f3281d193ce735d1f689dd175
Author: Ioannis Sermetziadis <[email protected]>
Date:   2017-09-28T20:56:49Z

    HTTPCLIENT-293 Refactored code in order to support multipart header field 
parameters in the data model and postpone the formatting and encoding of the 
parameters until the moment written into a stream, which is essential in order 
to avoid multiple encodings of the same value. Also provided a test case that 
fails due to incorrectly handling non US-ASCII characters in the filename field 
of the Content-Disposition header.

commit 1882a011ea49ea9c824fbea22a2905eb09bbe9ef
Author: Ioannis Sermetziadis <[email protected]>
Date:   2017-09-28T21:12:13Z

    HTTPCLIENT-293 Implemented the percent encoding of the filename parameter 
of the Content-Disposition header based on RFC7578 sections 2 and 4.2. Unit 
test is updated to use the new HttpMultipartMode successfully. In the new 
MultipartForm implementation I included a PercentCodec that performs 
encoding/decoding to/from the percent encoding as described in RFC7578 and 
RFC3986. The PercentCodec class as well as some inner classes should be 
proposed to the commons-codec project, which apparently does not provide a 
generic (URLCodec is not).

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to