mirror of
https://github.com/fangfufu/httpdirfs.git
synced 2024-09-30 14:11:16 +02:00
now uses curl-multi interface, it is so much faster
This commit is contained in:
parent
bfceba8e1b
commit
50b5c1ed3d
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS= -g -Wall -Wextra -lgumbo -lcurl -lfuse -D_FILE_OFFSET_BITS=64 \
|
CFLAGS= -g -Wall -Wextra -lgumbo -lcurl -lfuse -D_FILE_OFFSET_BITS=64 \
|
||||||
-DHTTPDIRFS_INFO -DHTTPDIRFS_SINGLE
|
-DHTTPDIRFS_INFO
|
||||||
OBJ = main.o network.o
|
OBJ = main.o network.o
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
Have you ever wanted to mount those HTTP directory listings as if it was a partition? Look no further, this is your solution. HTTPDirFS stands for Hyper Text Transfer Protocol Directory Filesystem
|
Have you ever wanted to mount those HTTP directory listings as if it was a partition? Look no further, this is your solution. HTTPDirFS stands for Hyper Text Transfer Protocol Directory Filesystem
|
||||||
|
|
||||||
|
The performance of the program is excellent, due to the use of curl-multi interface. HTTP connections are reused
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
./httpdirfs -f $URL $YOUR_MOUNT_POINT
|
./httpdirfs -f $URL $YOUR_MOUNT_POINT
|
||||||
An example URL would be [Debian CD Image Server](https://cdimage.debian.org/debian-cd/). The ``-f`` flag keeps the program in the foreground, which is useful for monitoring which URL the filesystem is visiting.
|
An example URL would be [Debian CD Image Server](https://cdimage.debian.org/debian-cd/). The ``-f`` flag keeps the program in the foreground, which is useful for monitoring which URL the filesystem is visiting.
|
||||||
@ -10,9 +12,6 @@ I noticed that most HTTP directory listings don't provide the file size for the
|
|||||||
|
|
||||||
This program downloads the HTML web pages/files using [libcurl](https://curl.haxx.se/libcurl/), then parses the listing pages using [Gumbo](https://github.com/google/gumbo-parser), and presents them using [libfuse](https://github.com/libfuse/libfuse)
|
This program downloads the HTML web pages/files using [libcurl](https://curl.haxx.se/libcurl/), then parses the listing pages using [Gumbo](https://github.com/google/gumbo-parser), and presents them using [libfuse](https://github.com/libfuse/libfuse)
|
||||||
|
|
||||||
## Notes
|
|
||||||
You might not want to use your actual GUI file browser when using this filesystem, KDE Dolphin caches the browser that you point your mouse at, it really does slow things down a lot!
|
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
10
network.c
10
network.c
@ -341,13 +341,14 @@ long Link_download(const char *path, char *output_buf, size_t size,
|
|||||||
buf.size = 0;
|
buf.size = 0;
|
||||||
buf.memory = NULL;
|
buf.memory = NULL;
|
||||||
|
|
||||||
CURL *curl = Link_to_curl(link);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&buf);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_RANGE, range_str);
|
|
||||||
#ifdef HTTPDIRFS_INFO
|
#ifdef HTTPDIRFS_INFO
|
||||||
fprintf(stderr, "Link_download(%s, %p, %s);\n",
|
fprintf(stderr, "Link_download(%s, %p, %s);\n",
|
||||||
path, output_buf, range_str);
|
path, output_buf, range_str);
|
||||||
#endif
|
#endif
|
||||||
|
CURL *curl = Link_to_curl(link);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&buf);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_RANGE, range_str);
|
||||||
|
|
||||||
transfer_wrapper(curl);
|
transfer_wrapper(curl);
|
||||||
|
|
||||||
long http_resp;
|
long http_resp;
|
||||||
@ -374,6 +375,9 @@ long Link_download(const char *path, char *output_buf, size_t size,
|
|||||||
|
|
||||||
LinkTable *LinkTable_new(const char *url)
|
LinkTable *LinkTable_new(const char *url)
|
||||||
{
|
{
|
||||||
|
#ifdef HTTPDIRFS_INFO
|
||||||
|
fprintf(stderr, "LinkTable_new(%s);\n", url);
|
||||||
|
#endif
|
||||||
LinkTable *linktbl = calloc(1, sizeof(LinkTable));
|
LinkTable *linktbl = calloc(1, sizeof(LinkTable));
|
||||||
if (!linktbl) {
|
if (!linktbl) {
|
||||||
fprintf(stderr, "LinkTable_new(): calloc failure!\n");
|
fprintf(stderr, "LinkTable_new(): calloc failure!\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user