hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [httpclient] URLEncodedUtils parser delimiters
Date Thu, 06 Jun 2013 13:47:22 GMT
On Thu, Jun 6, 2013 at 8:25 AM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Wed, 2013-06-05 at 12:48 -0400, Gary Gregory wrote:
> > Hi All:
> >
> > It seems to me that URLEncodedUtils.DELIM should be:
> >
> >     new char[] { '&', ';' };
> >
> > instead of:
> >
> >     new char[] { '&' };
> >
> > All the tests pass with this change. It just seems like an omission.
> >
> >
> > Also in
> > org.apache.http.client.utils.URLEncodedUtils.parse(List<NameValuePair>,
> > Scanner, String)
> >
> >     scanner.useDelimiter(PARAMETER_SEPARATOR);
> >
> > should be:
> >
> >     scanner.useDelimiter("[&;]");
> >
> > Am I missing something?
> >
>
>
> Gary
>
> Can you give an example (or better yet, a test case ;-)) of URL encoded
> content where semicolon is used as a delimiter?
>

Hi Oleg,

See notes 1, 2, and 3 in https://en.wikipedia.org/wiki/URI_scheme

   1. *^ <https://en.wikipedia.org/wiki/URI_scheme#cite_ref-1>* RFC
1866<https://tools.ietf.org/html/rfc1866>section 8.2.1 : by Tim
Berners-Lee in 1995 encourages CGI authors to
   support ';' in addition to '&'.
   2. *^ <https://en.wikipedia.org/wiki/URI_scheme#cite_ref-2>* HTML 4.01
   Specification: Implementation, and Design
Notes<http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.2.2>:
   "CGI implementors support the use of ";" in place of "&" to save authors
   the trouble of escaping "&" characters in this manner."
   3. *^ <https://en.wikipedia.org/wiki/URI_scheme#cite_ref-3>* Hypertext
   Markup Language -
2.0<http://www.w3.org/MarkUp/html-spec/html-spec_foot.html#FOOT26>"CGI
implementors are encouraged to support the use of ';' in place of '&'
"

I use URLEncodedUtils directly in my app to parse URL/URIs.

I'll add unit tests if these changes are deemed acceptable.

Gary


>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message