You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2008/03/15 16:56:24 UTC

[jira] Created: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

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


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.


[jira] Commented: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

Posted by "Thijs Vonk (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12596032#action_12596032 ] 

Thijs Vonk commented on WICKET-1426:
------------------------------------

On the dev-list people are talking about releasing 1.3.4. Is it possible to get this one in before that.

> 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.


[jira] Resolved: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matej Knopp resolved WICKET-1426.
---------------------------------

    Resolution: Cannot Reproduce

Please reopen if still valid

> 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.


[jira] Commented: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632468#action_12632468 ] 

Matej Knopp commented on WICKET-1426:
-------------------------------------

I removed the workaround code from Wicket because it was causing problems with absolute URLs. I can't reproduce the problem on Firefox (test both 2 and 3) with latest trunk

> 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.


[jira] Assigned: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg reassigned WICKET-1426:
-------------------------------------

    Assignee: Matej Knopp

> 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.


[jira] Commented: (WICKET-1426) URL creation in wicket-ajax.js -> Wicket.Ajax.Call.doGet produces broken URLs for Gecko

Posted by "Meetesh Karia (JIRA)" <ji...@apache.org>.
    [ 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.