Live data from Hacker News

Nweb: a tiny, safe web server (static pages only)

ibm.com

41–50 of 63 posts

Re: Nweb: a tiny, safe web server (static pages only)

#41
post #17

Earlier quoted context omitted.

although that server is very horrible

What's wrong with it? Honestly, I don't know. I know Python probably isn't a great choice for performance reasons, but anything else? It's super easy to build off and configure. Seems fine for a beginner (which I admittedly am; hence my asking).

Main issue is it's single threaded. So if you use it to share big files with an other machines, only 1 file can be downloaded at a time and a download will block browsing of available files.

Re: Nweb: a tiny, safe web server (static pages only)

#43
post #19

Adding to what everyone else has said, this also "how not" to write socket code; for instance, the assumption that you can read a whole HTTP request "in one go" with a single large read call is false. Also, casting function calls to (void) is nonsensical. You can perhaps forgive the sprintf() call because, AIX. (Believe it or not, there was a time when snprintf was a portability problem). You can't forgive the log()…

There is also the matter of directly stuffing the sockaddr_in with calls like inet_addr(), which has long been considered inferior to alternatives using getaddressinfo().

This also has the side effect of this implementation not supporting IPv6, among others.

So please, don't use this as anything other than an example how not to do sockets.

If you want to learn how to do it right, I can recommend the excellent "Guide to Network Programming Using Internet Sockets" by Brian "Beej Jorgensen" Hall (You should definitely buy the printed version, just to support him :)).

Re: Nweb: a tiny, safe web server (static pages only)

#45
post #5

I am always on the look out for a small, lightweight and secure web server for impromptu file sharing. Right now I use publicfile from djb.[^1] My only complaint is that there is no debian package for publicfile so I have to build my own package. I would love to find an equivalent (ftp not necessary) daemon that is included in debian. Is anyone aware of a something in debian repos that I am overlooking? [^1]: http://…

Webfsd is in the Debian repos but the stupid person who packaged it created an init script for it as if you want to run it as a service rather than ad hoc. So you may as well build from source...

Re: Nweb: a tiny, safe web server (static pages only)

#46
post #5

I am always on the look out for a small, lightweight and secure web server for impromptu file sharing. Right now I use publicfile from djb.[^1] My only complaint is that there is no debian package for publicfile so I have to build my own package. I would love to find an equivalent (ftp not necessary) daemon that is included in debian. Is anyone aware of a something in debian repos that I am overlooking? [^1]: http://…

[deleted]

Re: Nweb: a tiny, safe web server (static pages only)

#47
post #5

I am always on the look out for a small, lightweight and secure web server for impromptu file sharing. Right now I use publicfile from djb.[^1] My only complaint is that there is no debian package for publicfile so I have to build my own package. I would love to find an equivalent (ftp not necessary) daemon that is included in debian. Is anyone aware of a something in debian repos that I am overlooking? [^1]: http://…

thttpd?

https://packages.debian.org/search?keywords=thttpd

Re: Nweb: a tiny, safe web server (static pages only)

#48

Earlier quoted context omitted.

What's wrong with it? Honestly, I don't know. I know Python probably isn't a great choice for performance reasons, but anything else? It's super easy to build off and configure. Seems fine for a beginner (which I admittedly am; hence my asking).

Main issue is it's single threaded. So if you use it to share big files with an other machines, only 1 file can be downloaded at a time and a download will block browsing of available files.

It's also very buggy. Its only excuse is being old.

Re: Nweb: a tiny, safe web server (static pages only)

#49
post #11

I want to learn a bit about web servers and I think that study the source code of a functional one may worth more than try to build something from scratch at first glance. Since I'm seeing too many comments on the security issues of this particular project, can you guys recommend something more reliable? Thanks in advance. Edit: I "know" C and C++ and would like to remain in one of these languages, if it's not asking…

Try also libonion: https://github.com/davidmoreno/onion

It is not a HTTP server, but a library to create your own ones. With many examples, as a trivial only share files at https://github.com/davidmoreno/onion/blob/master/examples/ba...

Re: Nweb: a tiny, safe web server (static pages only)

#50
post #21

Does this do SSL ? If not, there is no reason to use this instead of the (excellent) thttpd. thttpd is a very, very nice tool. It's very handy sometimes to just fire up thttpd -d /some/dir because you want to look at the contents of the dir in a web browser but don't want to spin up the whole environment and server, etc. I put thttpd on a lot of informal servers just to have it around when I need something like that.…

This is not intended for real world usage. Its purpose is to help others learn how web servers work.
Post reply on HN