Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

smallest http server with scripting

Name: Anonymous 2010-08-08 22:26

make the smallest http server you can

List of things it need:
* HTTP 1.1
* 200 OK
* 404 Not Found
* Built-in 404 page [or user selectable]
* Some sort of _built-in_ scripting (ex. lua)
* Must be able to tell MIME type from file extension or contents
* Less than 1000 lines total (needs to be READABLE!)
* Doesn't use boost (fgts) or std (fgts). CRT is OK.
* Must be CONFIGURABLE [via command line or file]
* Only use standard sockets no SFML/boost/other [ie: winsock]
* Can be multi-client or be multi-threaded

Name: Anonymous 2010-08-08 22:41

Simply install Apache and you have all of these*!
  [sub][i]* I'm counting it at under 1000 lines of code because I did write any of it.[/i][/sub]

Name: Anonymous 2010-08-08 23:18

Do your own homework you lazy nigger.

Name: Anonymous 2010-08-08 23:29

Using Microsoft.VisualBasic.MyHttpServer

Name: lol u think i was joking? 2010-08-09 0:08

Here is my code <lua used as server-side scripting>
http://captmicro.pastebin.com/nLY6LDZA
im to lazy to copy-paste the ini to pastebin

Name: Anonymous 2010-08-09 0:09

thats less than 400 lines without the ini btw

Name: Anonymous 2010-08-09 0:12

oh just for the hell of it heres the ini that goes with it
http://captmicro.pastebin.com/vGHF6T8h

Name: Anonymous 2010-08-09 0:16

and i recommend you dont actually use it for a server, you can easily exploit it

Name: Anonymous 2010-08-09 1:41

>>5
[code]
#include <winsock2.h>
#include <WS2tcpip.h>
#include <windows.h>
#include <stdio.h>
[code]

What the hell is wrong with you? There is something wrong with you.

Name: Anonymous 2010-08-09 2:12

$ cd ~/factor/basis/http/server
$ find . -name '*.factor' \! -name '*docs*' \! -name '*tests*' -exec wc -l {} \+
      66 ./cgi/cgi.factor
      50 ./dispatchers/dispatchers.factor
       9 ./filters/filters.factor
      28 ./redirection/redirection.factor
      12 ./remapping/remapping.factor
      40 ./responses/responses.factor
      33 ./rewrite/rewrite.factor
     310 ./server.factor
     104 ./static/static.factor
     652 total

Name: Anonymous 2010-08-09 6:27

>>9
I find >>5 to be quite nice, it's configurable and scriptable, however I can see where you're coming from. Non-portable code tends to fill me with disgust. Since my main platform is Win32 (I use some flavours of *nix too), it's readable to me, however I tend to find completly unportable *nix code (which uses non-POSIX interfaces or whatever the OS offers) to be just as disgusting, so I can see where you're coming from. It's a shame portability in some languages is a lot more painful than in others, and most platforms I've encountered so far encourage the user to write non-portable code, some moreso than the other.

Name: Anonymous 2010-08-09 6:48

>>1
I wrote a small HTTP server, what will I do with it? Oh, I know, I'll start a shitty "contest" thread on /prog/ so that I can post it and win because no-one else will give a shit.
ftfy

Name: Anonymous 2010-08-09 12:36

__import__('CGIHTTPServer').test()

Name: Anonymous 2010-08-09 15:08

>>13
CGI == Bloat.

Real men use a HTTP library.

Name: Anonymous 2010-08-10 23:24

Name: Anonymous 2010-08-11 3:20

>>15
Fuck off, ``nigger''.

Name: Anonymous 2010-12-09 17:22

Name: Anonymous 2013-01-19 14:28

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List