hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1516) URL-encoded form paramters - missing '=' for null-values
Date Tue, 17 Jun 2014 09:03:01 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14033574#comment-14033574
] 

Oleg Kalnichevski commented on HTTPCLIENT-1516:
-----------------------------------------------

This is what is stated in http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1

{noformat}
 application/x-www-form-urlencoded  

This is the default content type. Forms submitted with this content type must be encoded as
follows:

    Control names and values are escaped. Space characters are replaced by `+', and then reserved
characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters
are replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code
of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').
    The control names/values are listed in the order they appear in the document. The name
is separated from the value by `=' and name/value pairs are separated from each other by `&'.
{noformat}

As far as I am concerned I see no mentioning of '=' being mandatory in case of a name not
having a value (value being null). 

RFC 1738 does not have a notion of a submission form and value/name encoding. I do not think
it is the right standard document in this particular case.

Oleg

> URL-encoded form paramters - missing '=' for null-values
> --------------------------------------------------------
>
>                 Key: HTTPCLIENT-1516
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1516
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.2.6, 4.3.2, 4.3.3, 4.3.4, 4.3.5
>            Reporter: Stanley Hillner
>
> If you pass {{null}} as the value for a post parameter and use URL-encoded form parameters
the Method {{org.apache.http.client.utils.URLEncodedUtils#format}} omits the separator character
({{=}}) for this parameter which results in urls like the following.
> {{http://example.org/test?a=1&b&c=2}}
> In this case parameter {{b}} was assigned {{null}} as its value.
> It is not totally clear if the key/value separator character must be present even if
the value is omitted (RFC 1738 doesn't handle this case) but this implementation leads to
incompatibilities to other systems.
> I encountered this issue with httpclient 4.2.1 on the one side and undertow web server
shipped with Wildfly 8.0.0.Final.
> I also opened an issue for undertow just to clarify the correct handling of null-values
for url-parameters: [https://issues.jboss.org/browse/UNDERTOW-258]



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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


Mime
View raw message