hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: UrlEncodedFormEntity and parameter value encoding
Date Sun, 18 Sep 2016 13:11:32 GMT
Hi Oleg,
Thanks for rapid answer.
Correct me if I am wrong but:
- URLENCODER is built from an or on UNRESERVED (which contains '_', '-',
'.', '*' and a-z, A-Z, 0-9.

URLENCODER is passed as safechars in
    private static String urlEncode(
            final String content,
            final Charset charset,
            final BitSet safechars,
            final boolean blankAsPlus)


@ is not part of the chars, so you end up in this part of algorithms right
?:
            } else {
                buf.append("%");
                final char hex1 =
Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX));
                final char hex2 =
Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
                buf.append(hex1);
                buf.append(hex2);
            }

And thus it gets URL encoded no ?

Thanks

On Sun, Sep 18, 2016 at 2:37 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> On Sun, 2016-09-18 at 14:08 +0200, Philippe Mouawad wrote:
> > On Sunday, September 18, 2016, Oleg Kalnichevski <olegk@apache.org>
> wrote:
> >
> > > On Sat, 2016-09-17 at 15:55 +0200, Philippe Mouawad wrote:
> > > > Hello,
> > > > We have a bug report at JMeter :
> > > > https://bz.apache.org/bugzilla/show_bug.cgi?id=60120
> > > >
> > > > Where  a user post a form with a parameter having this value
> > > > 'IqGo6EM1JEVZ+MSRJqUSo@qhjVMSFBTs'
> > > >
> > > > It appears that the '@' character is encoded.
> > > >
> > > > The form is submitted using application/x-www-form-urlencoded
> > > >
> > > > As per rfc:
> > > > > then reserved characters are escaped as described in [RFC1738]
> > > > <https://www.w3.org/TR/html401/references.html#ref-RFC1738>, section
> > > 2.2:
> > > >
> > > >
> > > > > The characters ";"  "/", "?", ":", "@", "=" and "&" are the
> characters
> > > > which may be reserved for special meaning within a scheme. No other
> > > > characters may be reserved within a scheme.
> > > >
> > > > So @ is reserved and as such HttpClient encodes it.
> > > >
> > > > But it is not clear for me if @ is reserved when place in URI or also
> > > > reserved when being part of a form parameter value.
> > > >
> > > > In JMeter code, we use UrlEncodedFormEntity and I check that when
> > > parameter
> > > > is passed , its value has still @ unencoded.
> > > >
> > >
> > > Why do you think it should be encoded?
> >
> >
> > I don't think it should but it is by HtTpClient class.
> > Maybe my last sentence was confusing, I recap, debugging the call, I see
> @
> > passed unencoded to httpclient method which encodes it.
> >
> >
>
> But it should not
>
> https://github.com/apache/httpclient/blob/4.5.x/
> httpclient/src/main/java/org/apache/http/client/utils/
> URLEncodedUtils.java#L654
>
> @ is not in the set of characters that need encoding
>
> https://github.com/apache/httpclient/blob/4.5.x/
> httpclient/src/main/java/org/apache/http/client/utils/
> URLEncodedUtils.java#L454https://github.com/apache/httpclient/blob/4.5.x/
> httpclient/src/main/java/org/apache/http/client/utils/
> URLEncodedUtils.java#L457
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Cordialement.
Philippe Mouawad.

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