bisakhmondal commented on pull request #6314:
URL: https://github.com/apache/apisix/pull/6314#issuecomment-1041512925
> This may still need to check table param
>
> ```lua
> for k, v in pairs(args) do
> if type(v) == "table" then
> for _, sv in pairs(v) do
> canonical_qs[#canonical_qs+1] = ngx.unescape_uri(k) .. "=" ..
ngx.unescape_uri(sv)
> end
> else
> canonical_qs[#canonical_qs+1] = ngx.unescape_uri(k) .. "=" ..
ngx.unescape_uri(v)
> end
> end
> ```
Ohh, Thanks! I missed the scenario : )
Btw, in that case, something still looks odd! We are considering one extra
level nesting in query params. Query params with nesting level > 2 would fail.
For example: (random example, taken from web)
```json
main_key[other_key][main_array][0][name]=Bob&main_key[other_key][main_array][0][nickname]=bobby&main_key[other_key][main_array][1][name]=Tom&main_key[other_key][main_array][1][nickname]=Tommy
{
"main_key": {
"other_key": {
"main_array": [{
"name": "Bob",
"nickname": "bobby"
},
{
"name": "Tom",
"nickname": "Tommy"
}
]
}
}
}
```
I think we need to perform a recursive DFS! Else it will introduce some sort
of indeterminism
```shell
🔥➜ ~ resty -e 'print(ngx.escape_uri({["a"]="b"}))'
table%3A%200x7f5aa8abc608
🔥➜ ~ resty -e 'print(ngx.escape_uri({["a"]="b"}))'
table%3A%200x7f7eca005608
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]