Inets HTTP client stability

Joe Armstrong (AL/EAB) joe.armstrong@REDACTED
Mon Oct 31 11:14:07 CET 2005


If you just want to handle HTTP ie parse the protocol and send a response
then I have a very simple web server that does this and nothing else:

    http://www.sics.se/~joe/tutorials/web_server/web_server.html

It's three small modules

	http_driver.erl (converts HTTP messages to erlang terms)
	tcp_server.erl  (handles tcp connections)
	web_server.erl  (a web server)

The web server and driver is 326 lines of code (including comments)
 
Also

	web_server.sh   (shell script to start and stop the web_server)
	
I also describe some trickery to ensure that your seb server is started correctly
when the system boots (ie what to put in your /etc/rc.d/rc.local ... - this is
specific to red-hat - but if you have understood the principles it is easy to
modify for any other OS (excepting windoze))
	
<gripe>

Processing HTTP is *extremely* easy - often *integrating* something like
Apache/tomcat/yaws with your application is more difficult that implementing from scratch the
sub-set of HTTP that you application will process - in such cases 
implementation an HTTP parser and a little bit of socket magic will get you
up-and-running quicker than the time taken to read the the tomcat/apache/yaws manual.

</gripe>

/Joe





> -----Original Message-----
> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED]On Behalf Of Claes Wikstrom
> Sent: den 28 oktober 2005 12:42
> To: Heinrich Venter
> Cc: erlang-questions@REDACTED
> Subject: Re: Inets HTTP client stability
> 
> 
> Heinrich Venter wrote:
> >>I would probably opt at yaws/ibrowse or a simple gen_tcp.
> > 
> > Why not the standard inets httpd/http?
> > I will not be serving actual web pages.  Instead it will 
> only be used
> > for http based protocols. Yaws seems a bit of overkill for something
> > like this.
> 
> If your're not serving webpages, you don't need a webserver - thus
> yaws isn't needed.
> 
> There are (to my knowledge) 2 http clients avilable for erlang.
> 
> - inets that come with otp, I've tried to use it a couple of times
>    but found it unstable and not ok.
> 
> - ibrowse from jungerl, just fine
> 
> 
> 
> /klacke
> 
> 
> -- 
> Claes Wikstrom                        -- Caps lock is nowhere and
> http://www.hyber.org                  -- everything is under control
> cellphone: +46 70 2097763
> 



More information about the erlang-questions mailing list