Real men write web servers in bash ;)<br><br><a href="http://ertw.com/~sean/news/May-23-2002.html">http://ertw.com/~sean/news/May-23-2002.html</a><br><br>Sean<br><br><div><span class="gmail_quote">On 7/25/06, <b class="gmail_sendername">
Sean Cody</b> &lt;<a href="mailto:sean@franticfilms.com">sean@franticfilms.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The HTTP protocol is so ridiculously simple yet usually implemented<br>in a convoluted and complicated way (ie. Apache, IIS).<br><br>If you ever wondered how a web server works but didn't care to read<br>the spec (RFC1945) take a look at this 'simple' implementation in Perl.,
<br>This is a basic web server, written as the basis for a component in<br>an embedded project I'm working on.<br>I've since decided to re-implement it in C (perl + chroot = annoying)<br>but the perl version would be a decent instructional tool.
<br><br><a href="http://bitbucket.ca/misc/www.tgz">http://bitbucket.ca/misc/www.tgz</a><br><br>I've implemented the bare minimum you need to make a web server.<br>The bare minimum needed is:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;-- Standard 'grab me a document' or CGI with appending key/
<br>values to the URL.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;POST&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;-- CGI without appending to URL<br><br>For the hell of it... MIME types and Cookie support are also in there<br>but only because they were easy.<br><br>Just so it works 'out of the box,' I've included a simple site which
<br>tests most of the functionality (save for cookies, I know it works<br>but too lazy to write a test case).<br><br>Contents of the Tarball:<br>www/www.pl &lt;-- Web server... runs on port 8080 by default but open it<br>
up and take a gander.<br>www/site/environment.cgi &lt;-- sh shell script...spits out the current<br>environment variables, ie CGI&nbsp;&nbsp;not in Perl<br>www/site/cgi_test.cgi &lt;-- Perl script, simple GET/POST handling.<br>www/site/index.html &lt;-- simple web page
<br>www/site/gibson_for_dummies.jpg &lt;-- included in simple web page and<br>proves MIME types are working.<br><br>The only use for this thing is if you really wanted to know how a web<br>server worked and didn't want the pain of dealing with the RFC or the
<br>Apache source.<br>I've tried to keep the code as clean and clear as possible (I know at<br>least one other person that could read and understand it).<br><br>If you find the damned thing useful then feel free to use it however
<br>you want.<br><br>--<br>Sean<br><br><br>_______________________________________________<br>Roundtable mailing list<br><a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br><a href="http://www.muug.mb.ca/mailman/listinfo/roundtable">
http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg &lt;<a href="mailto:sean@ertw.com">sean@ertw.com</a>&gt;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://ertw.com/">http://ertw.com/
</a>