News for hackers. Stuff that matters.
Re:Http-server, a simple zero-configuration command line htt... by mrud on Thursday June 16, 2011 @09:21PM (#2663947)
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 htt... by dolphenstein on Thursday June 16, 2011 @10:09PM (#2664053)
I built a simple zero-configuration FTP server that runs in a browser some time ago (http://ezyftpserver.com/). Been wondering if I should do the same with a HTTP server?
Re:Http-server, a simple zero-configuration command line htt... by mrud on Thursday June 16, 2011 @10:26PM (#2664089)
Nice idea, jftr opera already offers an http server inside your browser, it is called unite, see http://en.wikipedia.org/wiki/Opera_(web_browser)#Opera_Unite

I just had a look at your page and it seems you used java for providing the ftp server. How do you handle devices behind firewalls/NAT?

Re:Http-server, a simple zero-configuration command line htt... by dolphenstein on Thursday June 16, 2011 @10:36PM (#2664109)
I don't. :-) It's Apache FTP server wrapped in an applet.
Re:Http-server, a simple zero-configuration command line htt... by riledhel on Friday June 17, 2011 @01:00AM (#2664387)
I tried to visit your site but got redirected to a "Java Downloads for all operating systems" page. I do have java installed, but somehow your site doesn't notice and I always get redirected. I'm using ubuntu+chrome. It's annoying. I might not ever use the site, but I can't even see it with javascript enabled.
Re:Http-server, a simple zero-configuration command line htt... by gourneau on Thursday June 16, 2011 @08:57PM (#2663894)
python -m SimpleHTTPServer
Re:Http-server, a simple zero-configuration command line htt... by jc123 on Friday June 17, 2011 @12:25AM (#2664315)
python -m http.server

for Python 3.0+ http://docs.python.org/library/simplehttpserver.html

Re:Http-server, a simple zero-configuration command line htt... by createaccount94 on Friday June 17, 2011 @07:15AM (#2665084)
ruby -e 'require "rack"; Rack::Handler::Thin.run(Rack::Directory.new("."), :Port => 6666)'
Re:Http-server, a simple zero-configuration command line htt... by bitcoins on Thursday June 16, 2011 @09:00PM (#2663904)
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 htt... by irahul on Thursday June 16, 2011 @09:15PM (#2663934)
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 htt... by bitcoin on Thursday June 16, 2011 @09:21PM (#2663945)
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 htt... by aquark on Thursday June 16, 2011 @09:58PM (#2664029)
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?

Re:Http-server, a simple zero-configuration command line htt... by unshift on Thursday June 16, 2011 @11:28PM (#2664219)
once i wanted to serve a quick and dirty page of 200 thumbnails but python's HTTP server choked after a few people tried it concurrently. it's single threaded and just wouldn't hack it.

luckily if you have twisted installed, you can run "twistd web -n -p PORT --path ." it's just as easy as the basic HTTP server but way faster.

Re:Http-server, a simple zero-configuration command line htt... by loevborg on Friday June 17, 2011 @04:51AM (#2664869)
This is a very good suggestion.
Re:Http-server, a simple zero-configuration command line htt... by rlpb on Thursday June 16, 2011 @09:49PM (#2664007)
However, it is simple and it is zero-configuration - exactly your definition from your title.
Re:Http-server, a simple zero-configuration command line htt... by piotrSikora on Thursday June 16, 2011 @09:08PM (#2663923)
So is http-server supposed to be zero-configuration or configure-from-command-line server?
Re:Http-server, a simple zero-configuration command line htt... by bitcoin on Thursday June 16, 2011 @09:11PM (#2663928)
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 htt... by est on Thursday June 16, 2011 @11:19PM (#2664203)
Re:Http-server, a simple zero-configuration command line htt... by milkshakes on Friday June 17, 2011 @12:31AM (#2664327)
it's marak squires, he has lots of sock puppet accounts.
Re:Http-server, a simple zero-configuration command line htt... by naraktires on Friday June 17, 2011 @01:21AM (#2664432)
Re:Http-server, a simple zero-configuration command line htt... by sc68cal on Friday June 17, 2011 @01:48AM (#2664485)
That's lame. Take your downvotes and learn from them. Are you really that shallow?
Re:Http-server, a simple zero-configuration command line htt... by lmarinho on Thursday June 16, 2011 @10:59PM (#2664167)
Looks nice, I was looking for something similar the other day, easily sharing a directory over HTTP from command line. I ended up writing a couple of very simple bash functions that added/removed the current directory to ~/Sites (I'm on a Mac). Apache did the rest.
Re:Http-server, a simple zero-configuration command line htt... by sc68cal on Friday June 17, 2011 @01:09AM (#2664405)
sigh

Not another "Download this shell script over insecure HTTP and pipe it to sh" gimmick. Really? While http://news.ycombinator.com/item?id=2661209 is directly above this item on the front page?

Have we learned nothing?

Re:Http-server, a simple zero-configuration command line htt... by bitgroin on Friday June 17, 2011 @01:13AM (#2664412)
Like the documentation clearly states, there is nothing stopping you from:

     git clone git://github.com/nodejitsu/http-server.git
     cd http-server
     node bin/http-server
The curl installation is for npm, the node package manager, which is actually optional to use http-server
Re:Http-server, a simple zero-configuration command line htt... by nodesocket on Thursday June 16, 2011 @10:28PM (#2664094)
Nice work guys, any gzip support for js, css, and static html?
Re:Http-server, a simple zero-configuration command line htt... by d0vs on Friday June 17, 2011 @06:10AM (#2665006)
Node.js. lol.
Re:Http-server, a simple zero-configuration command line htt... by naughtysriram on Friday June 17, 2011 @02:52AM (#2664613)