fangfufu/httpdirfs

Ability to specify a single file directly (similar to httpfs)

breisig opened this issue ยท 12 comments

Is it possible to add the functionality to be able to show just 1 file instead of a directory file listing in a mounted path? I have a ISO file in a path that doesn't support web directory file listing and would like to be able to mount and show only that ISO file if I specify it directly.

Example.

httpdirfs --no-range-check https://www.example.com/mycrazypath/rocky-linux-8.iso /cdrom/

And it should should show
ls /cdrom/*
rocky-linux-8.iso

You can mount the directory containing the ISO file, then loop mount the ISO file as usual.

@fangfufu Yes, that is only correct only if the destination file browsing is enabled [or an index.html with the iso file listed in an ahref link]

What Works Currently:
If https://www.example.com/mycrazypath/ remote path has directory browsing enabled [and returns a 200 result code] or an index,html with the rocky-linux-8.iso file list in the HTML file as a a-href, I can mount the https://www.example.com/mycrazypath/ path, do an 'ls' and see the rocky-linux-8.iso file and loop mount the ISO file. [I can verify I can download it directly from https://www.example.com/mycrazypath/rocky-linux-8.iso even without directory browsing].

What Doesn't Work: [and would be a great feature to have] is:
If directory browsing is disabled on https://www.example.com/mycrazypath/ [Returns a 403 Forbidden] but I know that I can still access/download the ISO file directly if the path is known [https://www.example.com/mycrazypath/rocky-linux-8.iso can be downloaded directly from my browser], it would be nice if I could still httpdirfs mount that 1 file to show up in my mounted path. Currently, this does not work with the latest version from master.

Example of what would be great to support

httpdirfs --no-range-check https://www.example.com/mycrazypath/rocky-linux-8.iso /cdrom/

And it should should show
ls /cdrom/*
rocky-linux-8.iso

@breisig , you can use httpfs for that.

@fangfufu I have used httpfs but it's been abandoned for awhile now and mounting SSL url's is broken [only http links work]. This would be a great feature to add to httpdirfs for everyone to switch to your project.

Ok, you managed to convince me, I don't really have a timeline on when this will be done though.

@breisig , implemented via f42264d. It should be in the latest master branch. You need to activate it using single-file-mode.

For example:

./httpdirfs -f --cache --single-file-mode https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-11.0.0-amd64-netinst.iso mnt

Please have a try, and let me know what you think. If you like it, please spread good words of this software! ๐Ÿ™‚

Please, how to mount the file with url containing spaces? when I mounted in escaped format, the file name is escaped too and cannot be opened in OS. When I provide URL non excaped, it does not mount (Error:src/network.c:163:curl_process_msgs: 3 - URL using bad/illegal format or missing URL)

Re-opened the ticket - will investigate.

It seems that the problem is only present when I am using --cache, what is the most of times. Otherwise mounting of files with spaces in name (%20) works fine, but it is of course slow without cache.

Yes, the filename resolution has two paths. Because I wrote them at different times, and I wasn't good with software engineer (I probably still am not.) My team mate would call this "skills issue".

@EyitopeIO Could you propose a fix please? :P

Hey, @WizzardSK
This is now WIP and should have been fixed in a few days.

Closing this issue as the original request had been completed. @WizzardSK , in future please open new issues for bugs, rather than commenting on old feature request issues. :)