3 ms·
The url generated isn't valid according to curl: curl -v 'https://echoserver.dev/server?query={"headers":[["foo","bar"]],"body":{"type":"text","data":"asda
by tyilo 3y ago
The url generated isn't valid according to curl:
curl -v 'https://echoserver.dev/server?query={"headers":[["foo","bar"]],"body":{"type":"text","data":"asdasdasadsasdasd"},"status":200}'
curl: (3) nested brace in URL position 48:
https://echoserver.dev/server?query={"headers":[["foo","bar"]],"body":{"type":"text","data":"asdasdasadsasdasd"},"status":200}
It also sends a lot of extra headers:
CF-Cache-Status: DYNAMIC
CF-Ray: 7cacf9735d5c7373-CPH
Connection: keep-alive
Date: Sun, 21 May 2023 12:55:33 GMT
Server: cloudflare
Set-Cookie: __cf_bm=cAVNRtth0_6tpGLa8p2wbe6EuPRO2ZKITru5y9_GYgE-1684673733-0-AUMvqDbcxAHGRLPD2ghFL+6yJ0RKm0kGPtzsiU4jFChGrB02xtkPe8I2OX6+kFApwcWiEI1p+mFNA+esRO58cVI=; path=/; expires=Sun, 21-May-23 13:25:33 GMT; domain=.echoserver.dev; HttpOnly; Secure; SameSite=None
Set-Cookie: _cfuvid=wP9ezST2Ks4reP.MMtYKTxisnCjBHSGc65SDqhRDdCU-1684673733888-0-604800000; path=/; domain=.echoserver.dev; HttpOnly; Secure; SameSite=None
Transfer-Encoding: chunked
Vary: Accept-Encoding
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
x-render-origin-server: Render
- afn 3y agoBy default, curl interprets braces and square brackets to expand into multiple URLs (similarly to bash and other shells). You can disable this, and use literal braces & brackets in URLs, by passing ‘-g’ (‘--globoff’).
- layer8 3y agoBraces and square brackets (as well as double quotes) are not allowed unencoded in query strings, see the definition of pchar in https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 https://datatracker.ietf.org/doc/html/rfc3986#section-3.4.
- __s__ 3y agoThat's true. Although it will make the URL longer, I have decided to use encodeURIComponent to escape characters and avoid potential bugs.
- joeframbach 3y agoBased on this user's post history, I doubt you'll get a response. And seeing that the post was obviously written by chatgpt, I doubt they'll even be back to read your post.
- __s__ 3y agoI didn't test it with curl because I was assuming it would be used on the frontend, but as afn mentioned, I think it should work correctly if you add -g as shown below: curl -g -v 'https://echoserver.dev/server?query={"headers":[["foo","bar"]],"body":{"type":"text","data":"asdasdasadsasdasd"},"status":200 https://echoserver.dev/server?query={"headers":[["foo","bar"...}' Also, I am using render.com for hosting, and render.com uses Cloudflare internally, so it seems that related headers are also included. However, I believe this should not be a problem for testing purposes.