question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

impossible to restore the order of parameters after using QueryStringDecoder

See original GitHub issue

Expected behavior

Order of parameters at query string doesn’t change

Actual behavior

After using such classes as QueryStringDecoder the order of query string parameters changes

if any external library uses you decoder they will have a structure that will break the order of parameters before: param1=1&param2=2&param1=3 after: param1=1&param1=3&param2=2

Is it so neccessary to use such structure to store the parameters: Map<String, List<String>> because it is impossible to restore the order after we put parameters into value list here(addParams method of QueryStringDecoder.class):

 List<String> values = params.get(name);
 if (values == null) {
      values = new ArrayList<String>(1);  // Often there's only 1 value.
      params.put(name, values);
  }
 values.add(value);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Scottmitchcommented, Jun 6, 2017

Can you clarify what exactly is “broken”? What depends upon the order or query parameters and why can’t you use QueryStringDecoder.uri() for your use case?

i think that the decision to depend from order or not should depends from developers.

If there is no requirement to preserve order defined in any RFC your application shouldn’t depend upon a 3rd party library providing this functionality. If you want/need this behavior (and it is not defined in an RFC) I suggest you implement this behavior in your application.

0reactions
Scottmitchcommented, Jun 6, 2017

but as i know proxy server shouldn’t modify calls that go through it.

I would expect a proxy should preserve the semantics of the protocol. This doesn’t necessarily mean what comes in is exactly what goes out.

I will close this issue now. If you find a spot in the HTTP related RFCs which describes the behavior you request please re-open and provide a link.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in netty QueryStringDecoder is not handled by the ...
Any thoughts on this ? Looks like that when using vertx-web and query string is send with reserved characters it's unable to recover....
Read more >
io.netty.handler.codec.http.QueryStringDecoder.parameters ...
parameters. method. in. io.netty.handler.codec.http.QueryStringDecoder ... FOUND); // Check the order of the parameters in the quest string. final String ...
Read more >
QueryStringDecoder (Netty API Reference (4.1.85.Final))
Splits an HTTP query string into a path string and key-value parameter pairs. This decoder is for one time use only. Create a...
Read more >
Example usage for io.netty.handler.codec.http ... - Java2s.com
In this page you can find the example usage for io.netty.handler.codec.http QueryStringDecoder parameters. Prototype. public Map<String, List<String>> ...
Read more >
Java Examples for io.netty.handler.codec.http ... - Javatips.net
These source code samples are taken from different open source projects. ... params = queryStringDecoder.parameters(); String error = NettyHttpUtil.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found