Commit Graph

529 Commits

Author SHA1 Message Date
Jonathan Kamens 8451da6ac7 Comment out small block of code that doesn't do anything
There's a small block of code that calls strnlen on a string, saves
the esult in a variable, conditionally decrements the variable, and
then does nothing with it, making the entire block of code a no-op.

I don't want to just remove it entirely since it's possible that there
was intended to be some sort of check here that was inadvertently
omitted. So to make the compiler stop complaining I've commented out
the code, but I've left a comment above it explaining why it was
commented out and pointing out that maybe something different needs to
be done with it.
2023-09-29 23:45:47 +01:00
Jonathan Kamens e253b4a9ee Eliminate some compiler warnings 2023-09-29 23:45:47 +01:00
Jonathan Kamens 8f0ef158c0 Remove spurious arguments to print_version() 2023-09-29 23:45:47 +01:00
Jonathan Kamens c532661d29 Add missing error-checking for return value of fread
Several calls to fread were missing checks to ensure that the expected
amount of data was read.
2023-09-29 23:45:47 +01:00
Jonathan Kamens 7363adaf12 Handle sites that put unencoded characters in URLs that curl dislikes
Some sites put unencoded characters in their href attributes that
really should be encoded, most notably spaces. Curl won't accept a URL
with a space in it, and perhaps other such characters as well. Address
this by properly encoding characters in URLs before feeding them to
Curl.
2023-09-29 12:47:55 +01:00
Jonathan Kamens e94b5441f3 Add a few more debug messages to help trace program execution 2023-09-29 12:47:55 +01:00
Jonathan Kamens 3beccd2c2d Enabling debugging on command line should enable debug logging
I believe an appropriate expectation is that if the user enables
debugging with a command-line flag, then that should also enable
messagse designated as debug messages in the code to be printed.
2023-09-29 12:47:55 +01:00
Jonathan Kamens 4d323b846f Do the right thing with sites that use absolute links
On some sites, the link to each subfolder is an absolute link rather
than a relative one. To accommodate this, convert the links from
absolute to relative before storing them in the link table.
2023-09-29 12:47:55 +01:00
Jonathan Kamens 41cb4b80bc Do the right thing with sites that require the final slash
Some web sites will return 404 if you fetch a directory without the
final slash. For example, https://archive.mozilla.org/pub/ works,
https://archive.mozilla.org/pub does not. We need to do two things to
accommodate this:

* When processing the root URL of the filesystem, instead of stripping
  off the final slash, just set the offset to ignore it.
* In the link structure, store the actual URL tail of the link
  separately from its name, final slash and all if there is one, and
  append that instead of the name when constructing the URL for curl.
2023-09-29 12:47:55 +01:00
Fufu Fang 1e80844831 ran the code through formatter 2023-07-26 07:48:33 +08:00
Fufu Fang 6d8db94458 minor formatting changes for PR #114 2023-07-26 07:48:22 +08:00
Fufu Fang 282605b0ac fix: changed deprecated libcurl call 2023-07-25 14:57:08 +08:00
Mike Morrison a309994b9e
Add setting to refresh directory contents (#114)
Refresh a directory's contents when fs_readdir is called
if it has been more than the number of seconds specified by
--refresh_timeout since the directory was last indexed.
2023-03-31 13:26:15 +01:00
Kian-Meng Ang 9a7016f29b
Fix typos (#117)
Found via `codespell`
2023-03-28 05:00:07 +01:00
Fufu Fang 8479feb2f6
Bumped version number to 1.2.5 for Debian release 2023-02-24 19:47:23 +00:00
Fufu Fang fe45afc6a1
Remove the usage of UBSAN
Address issue #113. Use of UBSAN in runtime could introduce
vulnerabilities.

Original bug report:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031744

Reference:
https://www.openwall.com/lists/oss-security/2016/02/17/9
2023-02-23 01:44:18 +00:00
Jérôme Charaoui e9f60d5221
fix typo 2023-01-28 12:02:31 -05:00
Jérôme Charaoui 74fac1dce0
bump VERSION in Makefile 2023-01-28 12:01:06 -05:00
Fufu Fang 9b72f97bcf
Update README.md 2023-01-14 00:04:12 +00:00
Fufu Fang d91bb2b278
Update CHANGELOG.md 2023-01-11 23:56:19 +00:00
Fufu Fang f26a5bce25
Update CHANGELOG.md 2023-01-11 23:55:20 +00:00
Fufu Fang e6b5688e45
Modified Funkwhale sanitiser scheme 2022-11-06 23:45:13 +00:00
Fufu Fang 3acc093cdd
Merge pull request #106 from rdelaage/funkwhale_ioerror
Fix IO error with funkwhale subsonic API
2022-11-06 23:39:00 +00:00
Fufu Fang bb3b652135
Merge pull request #109 from nwf-msr/master
Add --cacert and --proxy-cacert
2022-11-02 08:19:26 +00:00
Nathaniel Wesley Filardo 12abb7d8ad Add --cacert and --proxy-cacert
Fixes https://github.com/fangfufu/httpdirfs/issues/108
2022-11-01 02:13:27 +00:00
Nathaniel Wesley Filardo ff5f566dd9 Link_download_full: don't FREE(NULL)
It's entirely possible that `ts.data` is `NULL` on an error path, so
handing it to `FREE()`, which bails on a `NULL` argument, is not ideal.
Just pass it to `free()` instead, which is required to no-op if given
`NULL`.
2022-11-01 01:59:03 +00:00
Nathaniel Wesley Filardo 833cbf9d67 Correct error message in FREE().
`FREE()` checks for a `NULL` pointer, but generally httpdirfs does not
`NULL` out pointers it attempts to `FREE()` (or `free()`).  As such, the
error message is misleading; make it less so in a trivial way.

Possibly a better, more invasive, change would be for `FREE()` to take a
`void** pp`, check that `*p != NULL`, `free(*p)`, and then `*p = NULL;`.
Were that done, then there would be some plausibility to the current
diagnostic message.
2022-11-01 01:59:03 +00:00
Romain de Laage abef0c9406
Fix IO error with funkwhale subsonic API 2022-09-23 07:49:36 +02:00
Fufu Fang 61d3ae4166
Merge pull request #104 from nwf-msr/202206-small-fixes
Two small patches
2022-08-12 00:49:03 +01:00
Nathaniel Wesley Filardo 72d15ab6c7 fs_open: return EROFS for non-RO opens
The use of EACCES leads to slightly confusing error messages in
downstream consumers, so prefer EROFS to better articulate what's
actually happening.

While here, use O_RDWR to mask the open flags while testing for
non-RO access.  This is at least encouraged by POSIX with their
suggestion that "O_RDONLY | O_WRONLY == O_RDWR".
2022-06-28 15:00:48 +01:00
Nathaniel Wesley Filardo ffb2658abb getopt_long returns an int, not a char
On platforms with an unsigned char, such as Arm, this results in
always taking error paths around initialization.

Fixes https://github.com/fangfufu/httpdirfs/issues/103
2022-06-28 14:45:31 +01:00
Jérôme Charaoui d1a10d489c add --name option to help2man
This resolves a lintian warning in Debian packaging
(manpage-has-useless-whatis-entry).
2022-04-24 00:27:12 -04:00
Fufu Fang 3b25cf31ef
Merge pull request #101 from moschlar/patch-1
Fix --insecure-tls in help and README
2022-04-23 02:49:50 +01:00
Fufu Fang d2207e7a4e
fixed --version switch 2022-04-23 02:49:16 +01:00
Jérôme Charaoui 66776261ca Remove generated manpage from repo
Packages generate it on the fly.
2022-04-22 12:32:47 -04:00
Moritz Schlarb a6f453c6a8
Update README.md 2022-04-04 15:38:38 +02:00
Moritz Schlarb 4d45525c64
Update main.c 2022-04-04 15:37:36 +02:00
Fufu Fang 40c750fac9 moved the location of error string 2021-09-04 13:37:45 +01:00
Fufu Fang 67edcc906f Clean up for the master branch 2021-09-04 12:41:33 +01:00
Fufu Fang cbe8c83195 stable version for master 2021-09-04 03:15:26 +01:00
Fufu Fang ebcfb0a79e periodic backup 2021-09-04 03:00:25 +01:00
Fufu Fang 5d539c30b1 started writing the ramcache 2021-09-04 01:28:01 +01:00
Fufu Fang 939e287c87 adjusted includes 2021-09-03 21:39:31 +01:00
Fufu Fang 6819ad09e4 removed unnecessary includes 2021-09-03 21:23:52 +01:00
Fufu Fang 7c6433f0cd more refactoring 2021-09-03 17:00:32 +01:00
Fufu Fang 1efe5932cf more refactoring 2021-09-03 16:58:08 +01:00
Fufu Fang ee32ddebc9 simplified network code 2021-09-03 16:36:50 +01:00
Fufu Fang dd8d887f94 more refactoring 2021-09-03 16:29:00 +01:00
Fufu Fang d403fa339b minor refactoring 2021-09-03 15:41:22 +01:00
Fufu Fang cd6bb5bee8 more refactoring 2021-09-03 14:56:11 +01:00