https://bz.apache.org/bugzilla/show_bug.cgi?id=69508

            Bug ID: 69508
           Summary: <jsp:include> in some circumstances produces malformed
                    url
           Product: Tomcat 10
           Version: 10.1.33
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: tarasvasyle...@gmail.com
  Target Milestone: ------

Pre-10.1.33 Tomcat properly generates java code for jsp:include like next

<jsp:include page="/main?cmd=someCommand">
  <jsp:param name="param1" value="value1"/>
</jsp:include>

Generated java code is:

org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response,
    "/main?cmd=someCommand"
        + "&"
        + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("param1",
request.getCharacterEncoding())
        + "="
        + org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("value1",
request.getCharacterEncoding()),
    out, false);

Resulting url is "/main?cmd=someCommand&param1=value1"

Starting from 10.1.33 generated java code is:

String _jspx_temp0_url = "/main?cmd=utility.getRefreshRate";
String _jspx_temp0_requestEncoding = request.getCharacterEncoding();
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response,
    _jspx_temp0_url
        + "?" +
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("rateType",
_jspx_temp0_requestEncoding)
        + "=" +
org.apache.jasper.runtime.JspRuntimeLibrary.URLEncode("Dashboard",
_jspx_temp0_requestEncoding)
    , out, false);

resulting url is "/main?cmd=someCommand?param1=value1". There are has two
question marks in url and it is malformed.

 As far as I understand issue was introduced by fix for 'Bug 69382 -
Inefficient code generated for <jsp:include>'. Source of the issue is the
introduction of the _jspx_temp0_url variable in 10.1.33. Method
generateIncludeWithParameters calls method printParams with variable name in
pageParam parameter instead of value from page attribute of jsp:include tag. As
result code in line 1030 now can't work properly.
I mean this code:
if (literal) {
    sep = pageParam.indexOf('?') > 0 ? "\"&\"" : "\"?\"";
} else {
    sep = "((" + pageParam + ").indexOf('?')>0? '&': '?')";
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to