9

I have a Windows user I want to share a large file with, they have Firefox with I understand supports resumable HTTP file downloads, and I have Ubuntu Linux, but limited disk space and such, so I don't want a full blown solution like Apache's web server.

I'd like to just run the server via the command line or GUI when I want, not on boot.

If I can avoid it, I don't want to edit a config file - I'd rather just give a command line argument for it's port, I'm used to using python -m SimpleHTTPServer - but I don't think it is resumable.

Luke Stanley
  • 843
  • 2
  • 9
  • 24
  • "share a ... file" - So... you want to transfer a file eh, and you don't want to use the FILE TRANSFER PROTOCOL why? – ta.speot.is Jul 07 '11 at 08:10
  • 2
    I don't find name-ism useful here, there is nothing wrong with wanting to use a browser to download a file especially since the end user is comfortable with it. Don't see what should be complex or problemabtic about running a resumable HTTP server, do you? – Luke Stanley Jul 07 '11 at 08:13
  • I have a partial answer I may post in ~6 hours (rep < 100): http://pastebin.com/DS0wedwk – Luke Stanley Jul 07 '11 at 09:36
  • @todda.speot.is: maybe because FTP is insecure and sends password across the network. – n0pe Jul 07 '11 at 13:08
  • 2
    Mainly it's because simplicity for end users is king. – Luke Stanley Jul 07 '11 at 21:07
  • @MaxMackie: There is *no difference* in security between anonymous FTP and standard HTTP; between plaintext-authenticated FTP and "Basic"-authenticated HTTP; between FTPS and HTTPS. – u1686_grawity Jul 07 '11 at 21:19
  • Except that anonymous FTP is likely to require reading help and anonymous HTTP is just standard. But yeah - SIMPLICITY is what I want and have found! Thanks everyone. – Luke Stanley Jul 07 '11 at 21:22
  • @grawity I was referring to using ssh – n0pe Jul 07 '11 at 21:26
  • Hey guys if you're passionate about the question perhaps up voting it would help ensure others will learn too. Currently this question stands at 0. Thanks. – Luke Stanley Jul 07 '11 at 21:33
  • @Luke: All browsers have [anonymous FTP support](ftp://ftp.sunet.se/pub/) built in. – u1686_grawity Jul 07 '11 at 21:56
  • Grawity they may but that doesn't mean that end users are familiar with it. For a one way resumable sharing of a file, HTTP is simple, following the principle of least surprise. – Luke Stanley Jul 07 '11 at 22:29

3 Answers3

15

Use thttpd.

thttpd -d /home/bob/sharedfolder -p 8080

The directory /home/bob/sharedfolder would become accessible at http://address:8080.

screenshot of thttpd directory listing in Chrome showing localhost on port 8080


lighttpd can be used in a similar way, although it needs a tiny config file. For example:

server.document-root = "/home/bob/sharedfolder"
server.port          = 8080
dir-listing.activate = "enable"

which is then ran like this:

lighttpd -f foo.conf
u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • Thanks grawity, I made some edits. Would appreciate some question upvotes. – Luke Stanley Jul 07 '11 at 21:22
  • even `python -m SimpleHTTPServer 8000` should be enough ... :) – akira Jan 23 '12 at 18:19
  • @akira: `SimpleHTTPServer` does not support byte ranges, meaning it cannot resume interrupted transfers. Test with `curl http://localhost:8000/testfile -o /dev/null -C 100`, for example. – u1686_grawity Jan 23 '12 at 18:21
  • This is exactly what I needed, using lighttpd now and it's working great. – Rob Jan 23 '12 at 18:38
  • @grawity: true. but that aside: might be a viable option. missing byte range: thats why i only put it aside your answer and not as a standalone answer. – akira Jan 24 '12 at 07:00
3

I recently created a python module, ext_http_server, that extends the functionality of the SimpleHTTPServermodule. One of its features is resumable file downloads, in addition to https, authentication and rate limiting.

Here's a direct link to the installation and usage instructions.

I should state that lighttpd contains all the same functionality so if you're looking for something production-ready go with lighttpd. If you're looking for using something in python that you can easily build-upon, check out ext_http_server.

bboe
  • 131
  • 3
  • that sounds cool! – Luke Stanley Aug 29 '12 at 04:55
  • I actually used this for something but I didn't want rate limiting, https or user/pass, so it's a bit verbose to command for what I wanted: ext_http_server --cert /home/luke/Downloads/cert.pem -d . -p 9191 -a test:test -r 999999999999999 – Luke Stanley Oct 23 '12 at 07:56
  • The default executable in the package that is created is meant to have all of those features. With a little work you could build your own executable (script) that has only the resumable downloads. However, in that case, it'll probably be faster to use thttpd or lighttpd. – bboe Oct 23 '12 at 18:38
  • Yeah, it might be worth considering a simple mode, or as a simple mode as a default. Nice work though, of course. – Luke Stanley Oct 23 '12 at 22:11
2

Use Lighttpd - You're using Linux so I guess you're familiar with the drill! Place the file you want to share in the /var/www folder Modify the init.d conf file to remove Lighttpd from bootup daemons.

Lighttpd does all you want and more - And, its not small, its TINY! ;)

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
adeelx
  • 1,278
  • 9
  • 8
  • Yeah I used Monkey already. Arbitrary difference perhaps. See: http://pastebin.com/DS0wedwk but I'm looking for a 0 config file solution if possible :) – Luke Stanley Jul 07 '11 at 09:35
  • lighttpd doesn't seem to support byte ranges if I download a file with curl I get: HTTP server doesn't seem to support byte ranges – Zibri Mar 02 '19 at 13:19