<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Th30z - Coding on the Fly &#187; Utils</title>
	<atom:link href="http://th30z.netsons.org/category/utils/feed/" rel="self" type="application/rss+xml" />
	<link>http://th30z.netsons.org</link>
	<description>Matteo Bertozzi, Objective-C, Cocoa, C, C++, Qt4, iPhone, Mac OS X, Open Moko, Matteo Bertozzi Development</description>
	<lastBuildDate>Sun, 22 Nov 2009 09:47:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bernardo The Smallest HTTPD Ever!</title>
		<link>http://th30z.netsons.org/2009/04/bernardo-the-smallest-httpd-ever/</link>
		<comments>http://th30z.netsons.org/2009/04/bernardo-the-smallest-httpd-ever/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 08:09:13 +0000</pubDate>
		<dc:creator>Matteo Bertozzi</dc:creator>
				<category><![CDATA[Utils]]></category>

		<guid isPermaLink="false">http://th30z.netsons.org/?p=752</guid>
		<description><![CDATA[Sometimes I need an HTTP Server that allows me to run C or Python code or other scripts, and I need something that require 0 seconds of configuration. So I&#8217;ve decided to write a small httpd that does this work. (Use only for your test, not on a work machine!).
Bernardo (The name is inspired by [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I need an HTTP Server that allows me to run C or Python code or other scripts, and I need something that require 0 seconds of configuration. So I&#8217;ve decided to write a small httpd that does this work. (Use only for your test, not on a work machine!).</p>
<p>Bernardo (<em>The name is inspired by the Zorro&#8217;s servant</em>) is a small HTTPD (Less that 200 lines of code) that allows you to Execute C, Python, Perl, PHP code or just &#8220;display&#8221; a file.</p>
<p>The Usage is Very simple: bernardo-httpd <www dir>
<port> where www dir will be di root of your server and port is the TCP Port of the Service.</p>
<p>And now a simple code Example. You need to complete the HTTP Response Headers and then you can output your data. http://localhost:8080/test.py will display the &#8220;Hello Python&#8221; page.<br />
<code></p>
<pre>
#!/usr/bin/env python

import os

if __name__ == '__main__':
    print "Content-Type: text/html"
    print

    print "&lt;html&gt;"
    print "&lt;head&gt;&lt;title&gt;Hello Python&lt;/title&gt;&lt;/head&gt;"
    print "&lt;body&gt;"
    print "&lt;h1&gt;Hello Python&lt;/h1&gt;"
    print "&lt;p&gt;&lt;b&gt;Request Method&lt;/b&gt;: ", os.environ['REQUEST_METHOD']
    print "&lt;p&gt;&lt;b&gt;Query String&lt;/b&gt;: ", os.environ['QUERY_STRING']
    print "&lt;/body&gt;"
    print "&lt;html&gt;"
</pre>
<p></code></p>
<p>The Source Code is Available Here: <a href="http://th30z.netsons.org/wp-content/uploads/bernardo-httpd.zip">Bernardo HTTPD Source Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://th30z.netsons.org/2009/04/bernardo-the-smallest-httpd-ever/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
