Skip to content

cURL doesn't like spaces in URLs #1

Open
@rimas-kudelis

Description

@rimas-kudelis

I had trouble today while attempting to download a file from Bunny. The first request (directory list) would succeed, but the second one (file download) would fail with a very non-descriptive error code 3 and no error message whatsoever, without even attempting to connect to the server.

A Google search hinted that error 3 has something to do with malformed URL's, but it took me a while to figure out that the problem was caused by a whitespace character in the file name. This doesn't seem documented anywhere, but I found a StackOverflow thread about it.

So, I have two alternative propositions:

  1. please fix whitespace handling. A simple str_replace() call on the URL does the trick.
  2. consider using PSR-18 HTTP client instead of cURL directly. cURL itself is too low level, difficult to debug, doesn't support logging and may even be unavailable. PSR-18 would abstract away this ugly dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions