Skip to content

http query string parser bug #161

Closed
Closed

Description

@maxim-ky

Greetings!

Class boost::network::uri::details::key_value_sequence< T > has bug when valid sequence "...param_name=&next_param_name=..." (empty value) isn't parsed.

Best regards

Activity

  1. maxim-ky commented on Oct 25, 2012

    @maxim-ky
    Author

    Also this parser doesn't support all valid characters (such as dot or underscore).

    http://en.wikipedia.org/wiki/Query_string#URL_encoding

  2. glynos commented on Oct 25, 2012

    @glynos
    Member

    Thanks for the report. I was already aware of the second issue.

  3. ghost assigned on Oct 26, 2012
  4. maxim-ky commented on Oct 30, 2012

    @maxim-ky
    Author

    Unfortunately I can't wait for the fixed version. Maybe used by me patches will be useful for you.

    cpp-netlib/boost/network/uri/accessors.hpp
    @@ -30,8 +30,8 @@
         {
             query =  pair >> *((spirit::qi::lit(';') | '&') >> pair);
             pair  =  key >> -('=' >> value);
    -        key   =  spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("a-zA-Z_0-9/%");
    -        value = +spirit::qi::char_("a-zA-Z_0-9/%");
    +        key   =  spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("a-zA-Z_0-9/%\\-_~\\.");
    +        value = *spirit::qi::char_("a-zA-Z_0-9/%\\-_~\\.+");
         }
    
         spirit::qi::rule<uri::const_iterator, Map()> query;
    

    Second patch fixes URI space encoding (as '+').

    cpp-netlib/boost/network/uri/decode.hpp
    @@ -77,6 +77,12 @@
                 *out++ = 0x10 * v0 + v1;
             }
             else
    +   if (*it == '+')
    +   {
    +       *out++ = ' ';
    +       ++ it;
    +   }
    +   else
             {
                 *out++ = *it++;
             }
    
  5. deanberris commented on Oct 30, 2012

    @deanberris
    Member

    Can you send this as a pull request instead? Thanks.

    Sent from a Galaxy Nexus.
    On 30/10/2012 11:22 PM, "maxim-ky" notifications@github.com wrote:

    Unfortunately I can't wait for the fixed version. Maybe used by me patches
    will be useful for you.

    cpp-netlib/boost/network/uri/accessors.hpp
    @@ -30,8 +30,8 @@
    {
    query = pair >> *((spirit::qi::lit(';') | '&') >> pair);
    pair = key >> -('=' >> value);

    •    key   =  spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("a-zA-Z_0-9/%");
      
    •    value = +spirit::qi::char_("a-zA-Z_0-9/%");
      
    •    key   =  spirit::qi::char_("a-zA-Z_") >> *spirit::qi::char_("a-zA-Z_0-9/%\-_~\.");
      
    •    value = *spirit::qi::char_("a-zA-Z_0-9/%\\-_~\\.+");
      

      }

      spirit::qi::rule<uri::const_iterator, Map()> query;

    cpp-netlib/boost/network/uri/decode.hpp
    @@ -77,6 +77,12 @@
    *out++ = 0x10 * v0 + v1;
    }
    else

    • if (*it == '+')
    • {
    •   *out++ = ' ';
      
    •   ++ it;
      
    • }
    • else
      {
      *out++ = *it++;
      }

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/161#issuecomment-9903596.

  6. maxim-ky commented on Oct 30, 2012

    @maxim-ky
    Author

    Yep, I can.

    #163

  7. glynos commented on Dec 9, 2012

    @glynos
    Member

    Merged.

  8. espes commented on Jan 15, 2014

    @espes

    This fix disappeared?

  9. deanberris commented on Jan 20, 2014

    @deanberris
    Member

    Technically this never appeared in a 0.x release, so I'm porting it over to 0.11-devel and rolling a new RC. Thanks @espes for the report!

  10. susnux commented on Apr 8, 2016

    @susnux

    Is this is still in open?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions