erickutcher / httpdownloader

HTTP(S) download manager that uses input/output completion ports (IOCP).
https://erickutcher.github.io/#HTTP_Downloader
558 stars 62 forks source link

Drag & Drop URL containing "+" char #184

Closed milo closed 2 years ago

milo commented 2 years ago

Hi @erickutcher,

thank you for the HTTPDownloader. I just downloaded it and I love it! Simple & small without unnecessary ballast.

When I drag & drop link with + char in it, it is "decoded" to space. For example:

https://example.com/downloads/my+file.txt  <-- link from Firefox I drag & drop
https://example.com/downloads/my file.txt  <-- URL appears in Download dialog

In webserver log I can find that HTTP downloader tries to download /downloads/my%20file.txt.

I think that escaping space by + is quite obsolete today and replaced by %20... anyway, I think that HTTP Downloader shoud preserve the + char in an URL.

And second issue - when HTTP Downloader tries to download non-existing file, it receives 404 HTTP from webserver but it saves the file and says "Completed", It is a little bit unexpected. I would expect "File not found" similar message. The downloaded file contains HTML:

Not Found

The requested URL was not found on this server.
------------------------------------
Apache/2.4.51 (Debian) Server at example.com Port 443  
erickutcher commented 2 years ago

Seems like the plus should only be decoded for URL parameters.

As far as the 404 download goes, I want to keep it that way. I could ignore it and only have the program download 200 and 206 responses, but I'd rather it be able to download every type of response.

milo commented 2 years ago

Thank you for the fix.

What about different row color for non 2xx responses? Or response code column? Just to be able recognize it.

erickutcher commented 2 years ago

I could probably add an option that allows non 200 and 206 responses to be downloaded and have it be off by default.

erickutcher commented 2 years ago

A new version is up that fixes this. Downloading non-200/206 requests can be enabled in the Advanced options.

milo commented 2 years ago

That's great. Thank you!

milo commented 2 years ago

I've tested new version. The non-200/206 option works well. But the + char is still translated to space.

Steps to reproduce.

  1. create file test.html with <a href="https://example.com/my+file.txt">my+file.txt</a> contents
  2. open it in browser
  3. drag & drop the link into HTTPDownloader
  4. Add URL(s) window pops up and URL(s) input area contains invalid https://example.com/my file.txt
erickutcher commented 2 years ago

I overlooked the drag and drop code. For now, until I release an update, you can just copy and paste the URL instead of dragging if there's a + symbol.

erickutcher commented 2 years ago

This should definitely be fixed in the latest build.

milo commented 2 years ago

Thank you! Works for me now.