Live data from Hacker News

Http-server, a simple zero-configuration command line http server

github.com

1–10 of 29 posts

Re: Http-server, a simple zero-configuration command line http server

#3
post #2

python -m SimpleHTTPServer

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex.

It also cannot serve 6,000 requests per second out of the box.

Re: Http-server, a simple zero-configuration command line http server

#4
post #3
post #2

python -m SimpleHTTPServer

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

So is http-server supposed to be zero-configuration or configure-from-command-line server?

Re: Http-server, a simple zero-configuration command line http server

#5
post #3

Earlier quoted context omitted.

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

So is http-server supposed to be zero-configuration or configure-from-command-line server?

Both.

It ships with sane defaults so you can type "http-server", but it also may optionally be configured with things like a path, a port, a host, etc.

Re: Http-server, a simple zero-configuration command line http server

#6
post #3
post #2

python -m SimpleHTTPServer

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

I did a `npm install http-server`.

It threw me a module not found error twice - once for `eyes` and once for `colors`

I ran it on a directory and tested it with `ab -n 100 -c 5 localhost:8080/`.

    Concurrency Level:      5
    Time taken for tests:   0.046 seconds
    Complete requests:      100
    Failed requests:        0
    Write errors:           0
    Total transferred:      175900 bytes
    HTML transferred:       149900 bytes
    Requests per second:    2159.97 [#/sec] (mean)
    Time per request:       2.315 [ms] (mean)
    Time per request:       0.463 [ms] (mean, across all concurrent requests)
    Transfer rate:          3710.33 [Kbytes/sec] received
So, in my micro benchmark, it doesn't do 6000 request/second on my box.

EDIT: `ab -n 15000 -c 5 localhost:8080/` is about 3000 req/s on my machine for http-server; 2200 for SimpleHTTPServer.

`python - SimpleHTTPServer 8080` gave me 1800 requests/second.

As far as configuration goes, for a dev server(that's what both SimpleHTTPServer and http-server are for me), the only configurations I do is to change the port.

Also, it's not like http-server is a highly configurable http server and framework combined into one - I for one can live without auto-index on/off.

Re: Http-server, a simple zero-configuration command line http server

#7
post #6
post #3

Earlier quoted context omitted.

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

I did a `npm install http-server`. It threw me a module not found error twice - once for `eyes` and once for `colors` I ran it on a directory and tested it with `ab -n 100 -c 5 localhost:8080/`. Concurrency Level: 5 Time taken for tests: 0.046 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 175900 bytes HTML transferred: 149900 bytes Requests per second: 2159.97 [#/sec] (mean) Tim…

Sorry about that. Bumped to v0.1.1 and published to npm.

Should fix [dist] issues. I have a feeling you need to update your npm to version 1.0 as well.

Re: Http-server, a simple zero-configuration command line http server

#8
Have a look at gatling http://www.fefe.de/gatling/ it's a http/ftp/smb server based on libowfat (-lowfat ;0) with ssl support. Contains basically everything you need to share a file. It is also quite scalable, see http://bulk.fefe.de/scalability/ for an old benchmark.

One neat feature is that gatling disables the autoindex links for sorting the listing if wget is used to download/mirror a directory.

Gatling has a pretty good default configuration like automatically try to bound port 80 and if not available use port 8000 instead, automatically sharing the current directory etc. For a list of command-line configuration options have a look at http://paste.pocoo.org/show/409206/

Re: Http-server, a simple zero-configuration command line http server

#9
post #3
post #2

python -m SimpleHTTPServer

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

However, it is simple and it is zero-configuration - exactly your definition from your title.

Re: Http-server, a simple zero-configuration command line http server

#10
post #3
post #2

python -m SimpleHTTPServer

python -m SimpleHTTPServer cannot be configured from the command line. You'll need to write an additional py script to do anything useful. It's also missing a bunch of features you are going to want, like AutoIndex. It also cannot serve 6,000 requests per second out of the box.

I can think of use cases for wanting a quick simple, easy to configure http server.

I can think of use cases for wanting to be able to serve >1,000 requests a second.

I can't think of any that fall into both categories ... am I just lacking imagination?

Post reply on HN