nitrogen / simple_bridge

A simple, standardized interface library to Erlang HTTP Servers.
MIT License
112 stars 76 forks source link

Deep POST params versus numeric index parsing #33

Open ztmr opened 10 years ago

ztmr commented 10 years ago

Deep POST params parsing does not work properly with numeric indices:

> (simple_bridge_request_wrapper:new ([], [], [], [], [], [])):parse_deep_post_params ([{"x[3]","x3:val"}], []).
[{"x",[2,1,0,"x3:val"]}]

...but if we make the index an alphanumeric word, it starts to behave as expected:

> (simple_bridge_request_wrapper:new ([], [], [], [], [], [])):parse_deep_post_params ([{"x[i3]","x3:val"}], []).
[{"x",[{"i3","x3:val"}]}]
choptastic commented 10 years ago

Hi, Thanks for the find. This is definitely an inconsistency that will need fixing. Indeed, I suspect treating numeric indices as numbers (ala PHP) probably shouldn't be done at all. That said, these changes were brought in to accommodate ChicagoBoss, so I wouldn't want to make such a significant change without first ensuring such a change wouldn't break anything.

ztmr commented 10 years ago

No problem, I just had to make a quick'n'dirty hack in ztmr/simple_bridge@d7673203893ddef5c9d442ec5dc48774dce696c5 because it blocked me in preparing a new version of our application that was going to be deployed on customer's site today. So it is in production now, but I hope this hack won't be temporary forever :-)

choptastic commented 10 years ago

Hi Tomas,

I was checking this out again, as I'm re-entering a stage where I plan on finishing up SimpleBridge 2.0, and I actually quite like this solution.

That said, how has this change been holding up in your production systems? Do you ruh this with ChicagoBoss, I assume?

ztmr commented 10 years ago

Both of the patches (ztmr/simple_bridge@d7673203893ddef5c9d442ec5dc48774dce696c5 and ztmr/simple_bridge@a101814ef6f3d201ca9fe2e5cecd93512d0179a2) worked as a charm, so if you're happy with the changes, let's merge them and be happy all together! ;-)

And yes, we use SB with a little older and hacked version of CB. As well as we need to stay with Erlang 15 for multiple reasons at the moment :(