sws: A simple web server for serving directories.

[ bsd3, program, web ] [ Propose Tags ]

The main drivers for this application were Windows (and Linux) support, security, and to a lesser extent performance.


[Skip to Readme]
Versions 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.4.0.0, 0.4.0.1, 0.4.1.0
Change log CHANGELOG.md
Dependencies base (>=4.9.1 && <4.11), bytestring (>=0.10.8 && <0.11), cryptonite (==0.24.*), directory (>=1.3.0 && <1.4), filepath (>=1.4.1 && <1.5), hourglass (>=0.2.10 && <0.3), http-types (>=0.9.1 && <0.10), network (>=2.6.3 && <2.7), resourcet (>=1.1.9 && <1.2), transformers (>=0.5.2 && <0.6), wai (>=3.2.1 && <3.3), wai-extra (>=3.0.20 && <3.1), wai-middleware-static (>=0.8.1 && <0.9), warp (>=3.2.13 && <3.3), warp-tls (>=3.2.4 && <3.3) [details]
License BSD-3-Clause
Copyright Copyright (c) 2014-2017 Derek Elkins
Author Derek Elkins
Maintainer derek.a.elkins@gmail.com
Revised Revision 1 made by DerekElkins at Wed Mar 28 21:38:21 UTC 2018
Category Web
Source repo head: git clone https://github.com/derekelkins/sws.git
Uploaded by DerekElkins at Wed Feb 14 21:26:08 UTC 2018
Distributions NixOS:0.4.1.0
Executables sws
Downloads 2610 total (19 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2018-02-16 [all 3 reports]
Hackage Matrix CI

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for sws-0.4.1.0

[back to package description]

Simple Web Server

What it is

sws is a self-contained web server that serves files which runs on Linux, Windows and (untested) Mac OS X. Once built, the executable should have no dependencies, e.g., it does not require OpenSSL. Convenience and security are the main goals. It has no config files, and only a few, if any, easily provided command line parameters should be necessary. If convenience and security conflict, I'm willing to sacrifice a little convenience for security, but only a little. Often such conflicts are largely resolvable. For example, requiring a password and using TLS improve security, but making a password or a certificate are inconvenient, so sws can generate these. Currently, support for generating a certificate is removed.

Use-case 1: xkcd scenario

You want to send a large file to someone. You browse to the directory containing it, type "sws", and give them your public IP. They browse to it and download. Maybe they are the ones sending the file, but aren't "technical". You browse to an empty directory, type "sws -w" or "sws -U", and give them your public IP. They browse to it and upload.

In reality, you need to figure out what your public IP is and open a port in your firewall. sws will currently use Google's STUN server to attempt to figure out your public IP.

Use-case 2: Client-side code demo/development

You build an unhosted web application or you mock out AJAX responses. You can do some simple testing by running "sws -d". (Admittedly, using a file URI will probably work pretty well too, though maybe not so much for mocked POST requests...) You want to show a friend. Just make that "sws".

Use-case 3: Instant read-only Git hosting

git clone --bare /path/to/myrepo ~/public/myrepo.git
cd ~/public/myrepo.git
mv hooks/post-update.sample hooks/post-update
chmod a+x hooks/post-update
git update-server-info
sws --no-compress -H example.com ~/public/

Elsewhere:

git -c http.sslVerify=false clone https://example.com:3000/myrepo.git

This would be even more instant with darcs.

What it isn't

This is not an app server. It reads and writes files, and that's all it will ever do. There is no way to add code to it. The Haskell ecosystem has plenty of good web frameworks. This is not one of them. It's an application, not a framework. (Well... you could do something with named pipes and/or interesting file systems... but you really shouldn't.)