This project is an extremely simple http server. It was written to transfer files between computers when a USB stick isn't handy, or is prohibited by IT security policies (ahem). It's designed to be launched on the command line, and shut down when the file transfer is finished.
It implements both file upload and download, and it works with very large files -- files over 100 GB have been transferred with it, in both directions. It's written in Kotlin, and should run against any reasonable Java runtime.
Source repository: https://github.com/zathras/simples/
Downloadable executable: simples.jar
To use, just launch from the command line, providing the directory you want to serve. Then go to the other computer, and type in the given URL in a browser (after adjusting any firewall settings that you might need to). There's even an option to use TLS to make a somewhat more secure connection, though this uses a self-signed certificate, and therefore doesn't protect against man-in-the-middle attacks.
For detailed instructions, I'll just let it speak for itself:
billf@Zathras:~$ java -jar lib/simples.jar Usage: java -jar simples.jar [-u] [-s] [-p port] dir [prefix] -u Enable uploads -s https: (insecure self-signed certificate) -p port Set port (default 6001) dir Directory to serve prefix Use fixed prefix instead of random number. "/" for no prefix. If no prefix is specified, a random number will be used. If you're on an open network, the prefix makes it unlikely an attacker will be able to do anything. You might need to configure your firewall to allow incoming connections. For example, on Ubuntu Linux, I use "ufw allow 6001/tcp". Remember to deny access when you're done! billf@Zathras:~$ java -jar lib/simples.jar -u ~/tmp Serving files from /home/billf/tmp at http://192.168.1.250:6001/5235318/ If you have a problem with port blocking in a browser, see the class header in SimpleHttp.java. You can always use curl, too.
While I was on a business trip, I found myself needing to exchange a file that was too big to e-mail with a colleague, and a USB key wasn't an option. I didn't want to wade through a bunch of configuration on file sharing or whatever might be in Windows, so I just grabbed some old HTTP server code I had handy, and adapted it. Over the next few months, I found it to be nice having a really simple, no-configuration HTTP server, so I ended up adding some improvements:
A bit of trivia: The core Java code for the server is derived from the
original HAT, which
went on to become
jhat in the JDK. That's the part in
server package, which I didn't kotlinify (beyond
IntelliJ's automatic conversion).
If you end up using this and find it useful, feel free to drop me a line! A little one-liner, like “I was in an internet cafe in Ljubljana, and I used to grab some photos off my phone” would be fun to get.