struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4862) Default Multipart validation regex is invalid due to charset encoding
Date Tue, 24 Oct 2017 07:56:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16216477#comment-16216477
] 

ASF subversion and git services commented on WW-4862:
-----------------------------------------------------

Commit 10027dae424231aeb6b7a4110ddc3c308bd2038b in struts's branch refs/heads/master from
[~lukaszlenart]
[ https://gitbox.apache.org/repos/asf?p=struts.git;h=10027da ]

WW-4862 Extends existing regex to include charset


> Default Multipart validation regex is invalid due to charset encoding
> ---------------------------------------------------------------------
>
>                 Key: WW-4862
>                 URL: https://issues.apache.org/jira/browse/WW-4862
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.5.13
>         Environment: JDK8
> Tomcat 8.0
> Struts 2.5.13
>            Reporter: Paolo Perliti
>              Labels: charset, multipart, regex, struts2
>             Fix For: 2.5.14
>
>
> Struts 2.5.12 introduced a regex matches for multipart requests. 
> Struts 2.5.13 fixed WW-4818 issue, still it does fails due to charset encoding being
appended after the boundary marker (the regex does not match).
> Here's the header sent in browser's request:
> {code}
> Content-Type: multipart/form-data; boundary=---------------------------207103069210263
> {code}
> And this is the header handled in Struts' Dispatcher wrapRequest() method:
> {code}
> multipart/form-data; boundary=---------------------------207103069210263;charset=UTF-8
> {code}
> The issue seems to be related to the _applyEncoding _method (called in _prepare_ method)
> {code:title=Dispatcher.java|borderStyle=solid}
>     private void applyEncoding(HttpServletRequest request, String encoding) {
>         try {
>             if (!encoding.equals(request.getCharacterEncoding())) {
>                 // if the encoding is already correctly set and the parameters have been
already read
>                 // do not try to set encoding because it is useless and will cause an
error
>                request.setCharacterEncoding(encoding);
>             }
>         } catch (Exception e) {
>             LOG.error("Error setting character encoding to '{}' - ignoring.", encoding,
e);
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message