treeform / puppy

Puppy fetches via HTTP and HTTPS
MIT License
184 stars 27 forks source link

spaces in url #80

Closed 4zv4l closed 1 year ago

4zv4l commented 1 year ago

I have this Nim code in here

import puppy
import os

let
  url = "https://funquizzes.fun/uploads/manga/One%20Punch%20Man/"

echo url
echo execShellCmd("curl "&url)
echo fetch(url)

with curl it works but with puppy it doesn't work because it seems that the fetch function replace spaces or %20 by '+' anyway which the server I try to fetch doesn't accept. Anything I can do about that ?

nnsee commented 1 year ago

For context:

Spaces should never be encoded as + in URL paths, as defined by RFC 3986 - they should always be encoded as %20. Any + in a path is to be interpreted literally, and not as a space.

Spaces can be encoded both as + and as %20 in query parameters and values (everything after a ? in an URL), as that has the content type application/x-www-form-urlencoded, which defines the + encoding. Only the query part of an URL is application/x-www-form-urlencoded.

treeform commented 1 year ago

Thank you for the issue!

This should be fixed in 1.5.5.

Feel free to reopen if you still have issues.