[ 
https://issues.apache.org/jira/browse/WICKET-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587245#action_12587245
 ] 

Meetesh Karia commented on WICKET-1426:
---------------------------------------

The overall fix still has problems when there is an absolute path in the 
header, etc.  The following patch to wicket-ajax.js (1.3.2 released version) 
works for us and avoids the problem with slashes in the query string:

826,831c826,841
<                                       var lastIndexOf = href.lastIndexOf('/');
<                                       if (lastIndexOf > 0)
<                                       {
<                                               url = 
href.substring(0,lastIndexOf+1) + url;
<                                       }
<                               }
---
>                     var hostIdx = href.indexOf(document.location.host);
>                     if (hostIdx >= 0) {
>                         href = href.substring(0, hostIdx + 
> document.location.host.length);
>                     }
>
>                     if (url.length > 0 && url.charAt(0) != '/') {
>                         var pathname = document.location.pathname;
>                         var lastIdx = pathname.lastIndexOf('/');
>                         if (lastIdx >= 0) {
>                             pathname = pathname.substring(0, lastIdx + 1)
>                         }
>                         href += pathname;
>                     }
>
>                     url = href + url;
>                 }

> URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs 
> for Gecko
> ---------------------------------------------------------------------------------------
>
>                 Key: WICKET-1426
>                 URL: https://issues.apache.org/jira/browse/WICKET-1426
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.2
>         Environment: Firefox 2
>            Reporter: Martin Grigorov
>            Assignee: Matej Knopp
>
> With r628015 (Wicket 1.3.2) creation of full URL for Gecko browsers creates 
> broken URLs when there is a slash ('/') in the http parameter values.
> For example when a page with this URL is loaded: 
> http://localhost/app?key=value/ 
>  wicketAjaxGet will issue a query with this content:
> http://localhost/app?key=value/../?wicket:interface=:....
> By RFC2396 the query part of URL could be:
>  query         = *uric
>  uric          = reserved | unreserved | escaped
>  reserved      = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
>                       "$" | ","
>  unreserved    = alphanum | mark
> So '/' is allowed.
> Here is a quick patch:
> --- wicket-ajax.js      (revision 637425)
> +++ wicket-ajax.js      (working copy)
> @@ -823,6 +823,10 @@
>                         if (t != null) {
>                                 if (Wicket.Browser.isGecko()) {
>                                         var href = document.location.href;
> +                                       var lastIndexOfQuestionMark = 
> href.lastIndexOf('?');
> +                                       if (lastIndexOfQuestionMark > -1) {
> +                                               href = href.substring(0, 
> lastIndexOfQuestionMark);
> +                                       }
>                                         var lastIndexOf = 
> href.lastIndexOf('/');
>                                         if (lastIndexOf > 0)
>                                         {

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to