You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sumitkathuria <su...@gmail.com> on 2012/08/15 08:08:36 UTC

URL params parsing issue if param value contain '='

Hello,

We are in process of integrating our application with the third party
application and during the auth flow, The wicket is not returning the
correct parameter value when the third party application passes the
parameter value containing = operator.

After doing the initial investigation, i came to know that there is function
in URL class which splits the query parameter key value string based upon
"=" operator which is causing problem. 

/private static QueryParameter parseQueryParameter(final String qp, final
Charset charset)
	{
		if (qp.indexOf('=') == -1)
		{
			// name => empty value
			return new QueryParameter(decodeParameter(qp, charset), "");
		}

		*String parts[] = Strings.split(qp, '=');*
		return new QueryParameter(decodeParameter(parts[0], charset),
decodeParameter(parts[1],
			charset));
	}/

It would be really helpful if some one can suggest me the resolution for
this issue. It is not possible for us to ask third party application for
encoding the URL parameters, we have to do something at our end only.




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/URL-params-parsing-issue-if-param-value-contain-tp4651238.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: URL params parsing issue if param value contain '='

Posted by sumitkathuria <su...@gmail.com>.
Can i use IPageParametersEncoder here? I can use the Base64 encoding decoding
there and implement the below strategy.

when the first request(*page.html?param1=paramvalue==*) comes 
I can get the request params from native HTTPServletRequest and put that
value in page parameters without encoding.

Wicket will do the redirection to the url
*page.html/param1/encoded_paramvalue* and next time things will work as
expected as the param value is encoded now.

By doing this, the fix will be specific to this feature and there won't be
any impact on any other module.









--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/URL-params-parsing-issue-if-param-value-contain-tp4651238p4651242.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: URL params parsing issue if param value contain '='

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can wrap the HttpServletRequest (see HttpServletRequestWrapper)
and fix the query string by encoding the additional '=' char.

On Wed, Aug 15, 2012 at 9:08 AM, sumitkathuria <su...@gmail.com> wrote:
> Hello,
>
> We are in process of integrating our application with the third party
> application and during the auth flow, The wicket is not returning the
> correct parameter value when the third party application passes the
> parameter value containing = operator.
>
> After doing the initial investigation, i came to know that there is function
> in URL class which splits the query parameter key value string based upon
> "=" operator which is causing problem.
>
> /private static QueryParameter parseQueryParameter(final String qp, final
> Charset charset)
>         {
>                 if (qp.indexOf('=') == -1)
>                 {
>                         // name => empty value
>                         return new QueryParameter(decodeParameter(qp, charset), "");
>                 }
>
>                 *String parts[] = Strings.split(qp, '=');*
>                 return new QueryParameter(decodeParameter(parts[0], charset),
> decodeParameter(parts[1],
>                         charset));
>         }/
>
> It would be really helpful if some one can suggest me the resolution for
> this issue. It is not possible for us to ask third party application for
> encoding the URL parameters, we have to do something at our end only.
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/URL-params-parsing-issue-if-param-value-contain-tp4651238.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: URL params parsing issue if param value contain '='

Posted by Joachim Schrod <js...@acm.org>.
sumitkathuria wrote:
> Hello,
> 
> We are in process of integrating our application with the third party
> application and during the auth flow, The wicket is not returning the
> correct parameter value when the third party application passes the
> parameter value containing = operator.
> 
> After doing the initial investigation, i came to know that there is function
> in URL class which splits the query parameter key value string based upon
> "=" operator which is causing problem. 
> 
> /private static QueryParameter parseQueryParameter(final String qp, final
> Charset charset)
> 	{
> 		if (qp.indexOf('=') == -1)
> 		{
> 			// name => empty value
> 			return new QueryParameter(decodeParameter(qp, charset), "");
> 		}
> 
> 		String parts[] = Strings.split(qp, '=');

IMO, this call is wrong. It should be

 		String parts[] = Strings.split(qp, '=', 2);

I'd file a bug and patch the code locally.

> 		return new QueryParameter(decodeParameter(parts[0], charset),
> decodeParameter(parts[1],
> 			charset));
> 	}/
> 
> It would be really helpful if some one can suggest me the resolution for
> this issue. It is not possible for us to ask third party application for
> encoding the URL parameters, we have to do something at our end only.

Cheers,
	Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jschrod@acm.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org