Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [ANN] Mongrel HTTP Library 0.2.2 (Serving Directories)

Reply
Thread Tools

[ANN] Mongrel HTTP Library 0.2.2 (Serving Directories)

 
 
Zed Shaw
Guest
Posts: n/a
 
      02-03-2006
Hey Folks,

Another announcement of Mongrel -- the fastest little web server
library for Ruby yet. This release is nice in that it should build
on win32 better and it now sports a small DirHandler that can serve
directories and files. This means Mongrel is closer to replacing
WEBrick as a Rails debug runner.

You can get the releases and information from:

* http://rubyforge.org/projects/mongrel/ -- project page
* http://mongrel.rubyforge.org/ -- RDoc documentation.

== Install and Upgrade

People who use(d) RubyGems can simply do:

gem install mongrel

-or-

gem upgrade

And they'll get the new gear. You can go back to the project page
and download the source .tgz if you installed using that.

== Changes

* Fixed a header so that win32 folks can build it.
* Added all CGI parameters that didn't cause security or performance
problems.
* Forced the sockets to not do reverse name lookup (huge performance
hit for little benefit).
* Created a REQUEST_URI parameter that has the original untouched URI
used in the request. This is the string used to lookup the handlers
and create the SCRIPT_NAME and PATH_INFO parameters.
* Implemented a basic directory serving handler called DirHandler.
It will serve files in a directory, print a simple directory listing,
and tries to protect against malicious path requests.
* Some minor code clean-ups and additional documentation regarding
constants used.

== The DirHandler

The really simple DirHandler is used like this (from the examples/
simpletest.rb file):

h = Mongrel::HttpServer.new("0.0.0.0", "3000")
h.register("/files", Mongrel:irHandler.new("."))
h.run.join

This simply sets things up so that when people go to /files, they get
the contents of the current directory. The DirHandler expands the
path you give it so that when requests come in, it can expand them
too and make sure that both paths have the same prefix. If not it
will reject them. There is also an option to turn off the directory
listings using the second parameter to DirHandler.new().

This initial file serving is very simplistic since it doesn't map
extensions to mime types yet. It should be a good start for some
people though.


== Feedback

Thanks for all the feedback and bug reports so far. With directory
serving and complete CGI parameters out of the way I'm going to start
working on a Rails runner using Mongrel next, and possibly a caching
system. Goal for the weekend will be to get a Rails application
running in Mongrel standalone.

Enjoy!

Zed A. Shaw
http://www.zedshaw.com/




 
Reply With Quote
 
 
 
 
Tanner Burson
Guest
Posts: n/a
 
      02-03-2006
------=_Part_5175_1244389.1138977525411
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 2/3/06, Zed Shaw <(E-Mail Removed)> wrote:
>
> Hey Folks,
>
> Another announcement of Mongrel -- the fastest little web server
> library for Ruby yet. This release is nice in that it should build
> on win32 better and it now sports a small DirHandler that can serve
> directories and files. This means Mongrel is closer to replacing
> WEBrick as a Rails debug runner.
>
> You can get the releases and information from:
>
> * http://rubyforge.org/projects/mongrel/ -- project page
> * http://mongrel.rubyforge.org/ -- RDoc documentation.
>
> =3D=3D Install and Upgrade
>
> People who use(d) RubyGems can simply do:
>
> gem install mongrel
>
> -or-
>
> gem upgrade
>
> And they'll get the new gear. You can go back to the project page
> and download the source .tgz if you installed using that.
>
> =3D=3D Changes
>
> * Fixed a header so that win32 folks can build it.
> * Added all CGI parameters that didn't cause security or performance
> problems.
> * Forced the sockets to not do reverse name lookup (huge performance
> hit for little benefit).
> * Created a REQUEST_URI parameter that has the original untouched URI
> used in the request. This is the string used to lookup the handlers
> and create the SCRIPT_NAME and PATH_INFO parameters.
> * Implemented a basic directory serving handler called DirHandler.
> It will serve files in a directory, print a simple directory listing,
> and tries to protect against malicious path requests.
> * Some minor code clean-ups and additional documentation regarding
> constants used.
>
> =3D=3D The DirHandler
>
> The really simple DirHandler is used like this (from the examples/
> simpletest.rb file):
>
> h =3D Mongrel::HttpServer.new("0.0.0.0", "3000")
> h.register("/files", Mongrel:irHandler.new("."))
> h.run.join
>
> This simply sets things up so that when people go to /files, they get
> the contents of the current directory. The DirHandler expands the
> path you give it so that when requests come in, it can expand them
> too and make sure that both paths have the same prefix. If not it
> will reject them. There is also an option to turn off the directory
> listings using the second parameter to DirHandler.new().
>
> This initial file serving is very simplistic since it doesn't map
> extensions to mime types yet. It should be a good start for some
> people though.
>
>
> =3D=3D Feedback
>
> Thanks for all the feedback and bug reports so far. With directory
> serving and complete CGI parameters out of the way I'm going to start
> working on a Rails runner using Mongrel next, and possibly a caching
> system. Goal for the weekend will be to get a Rails application
> running in Mongrel standalone.
>
> Enjoy!
>
> Zed A. Shaw
> http://www.zedshaw.com/
>
>
>
>

Like Daniel Sheppard in the previous version I'm getting errors when
attempting the following on windows:

irb(main):001:0> require_gem 'mongrel'
=3D> true
irb(main):002:0> p Mongrel
NameError: uninitialized constant Mongrel
from (irb):2
irb(main):003:0>

Looking at the gem install itself, everything seems to have been created
correctly. I have a mongrel.rb in mongrel's lib dir, just can't seem to ge=
t
it to actually LOAD correctly. Any help would be great.

--
=3D=3D=3DTanner Burson=3D=3D=3D
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://tannerburson.com <---Might even work one day...

------=_Part_5175_1244389.1138977525411--


 
Reply With Quote
 
 
 
 
Tanner Burson
Guest
Posts: n/a
 
      02-03-2006
------=_Part_5203_20381648.1138977675536
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 2/3/06, Tanner Burson <(E-Mail Removed)> wrote:
>
>
>
> On 2/3/06, Zed Shaw <(E-Mail Removed)> wrote:
> >
> > Hey Folks,
> >
> > Another announcement of Mongrel -- the fastest little web server
> > library for Ruby yet. This release is nice in that it should build
> > on win32 better and it now sports a small DirHandler that can serve
> > directories and files. This means Mongrel is closer to replacing
> > WEBrick as a Rails debug runner.
> >
> > You can get the releases and information from:
> >
> > * http://rubyforge.org/projects/mongrel/ -- project page
> > * http://mongrel.rubyforge.org/ -- RDoc documentation.
> >
> > =3D=3D Install and Upgrade
> >
> > People who use(d) RubyGems can simply do:
> >
> > gem install mongrel
> >
> > -or-
> >
> > gem upgrade
> >
> > And they'll get the new gear. You can go back to the project page
> > and download the source .tgz if you installed using that.
> >
> > =3D=3D Changes
> >
> > * Fixed a header so that win32 folks can build it.
> > * Added all CGI parameters that didn't cause security or performance
> > problems.
> > * Forced the sockets to not do reverse name lookup (huge performance
> > hit for little benefit).
> > * Created a REQUEST_URI parameter that has the original untouched URI
> > used in the request. This is the string used to lookup the handlers
> > and create the SCRIPT_NAME and PATH_INFO parameters.
> > * Implemented a basic directory serving handler called DirHandler.
> > It will serve files in a directory, print a simple directory listing,
> > and tries to protect against malicious path requests.
> > * Some minor code clean-ups and additional documentation regarding
> > constants used.
> >
> > =3D=3D The DirHandler
> >
> > The really simple DirHandler is used like this (from the examples/
> > simpletest.rb file):
> >
> > h =3D Mongrel::HttpServer.new("0.0.0.0", "3000")
> > h.register("/files", Mongrel:irHandler.new("."))
> > h.run.join
> >
> > This simply sets things up so that when people go to /files, they get
> > the contents of the current directory. The DirHandler expands the
> > path you give it so that when requests come in, it can expand them
> > too and make sure that both paths have the same prefix. If not it
> > will reject them. There is also an option to turn off the directory
> > listings using the second parameter to DirHandler.new().
> >
> > This initial file serving is very simplistic since it doesn't map
> > extensions to mime types yet. It should be a good start for some
> > people though.
> >
> >
> > =3D=3D Feedback
> >
> > Thanks for all the feedback and bug reports so far. With directory
> > serving and complete CGI parameters out of the way I'm going to start
> > working on a Rails runner using Mongrel next, and possibly a caching
> > system. Goal for the weekend will be to get a Rails application
> > running in Mongrel standalone.
> >
> > Enjoy!
> >
> > Zed A. Shaw
> > http://www.zedshaw.com/
> >
> >
> >
> >

> Like Daniel Sheppard in the previous version I'm getting errors when
> attempting the following on windows:
>
> irb(main):001:0> require_gem 'mongrel'
> =3D> true
> irb(main):002:0> p Mongrel
> NameError: uninitialized constant Mongrel
> from (irb):2
> irb(main):003:0>
>
> Looking at the gem install itself, everything seems to have been created
> correctly. I have a mongrel.rb in mongrel's lib dir, just can't seem to
> get it to actually LOAD correctly. Any help would be great.
>
>


Sorry for the double post, but as it turns out I get an Identical error on
my Debian box as well, so something in the install seems to be a bit
fubar'd.

--
=3D=3D=3DTanner Burson=3D=3D=3D
(E-Mail Removed)
http://tannerburson.com <---Might even work one day...

------=_Part_5203_20381648.1138977675536--


 
Reply With Quote
 
zedshaw@zedshaw.com
Guest
Posts: n/a
 
      02-03-2006
Did you make sure to require rubygems first? Here's my install:

[zedshaw@dinky ~]$ irb -rubygems
irb(main):001:0> require 'mongrel'
=3D> true
irb(main):002:0>
[zedshaw@dinky ~]$
irb(main):001:0> require 'rubygems'
=3D> true
irb(main):002:0> require 'mongrel'
=3D> true
[zedshaw@dinky ~]$ irb
irb(main):001:0> require 'mongrel'
LoadError: no such file to load -- http11
from ./mongrel.rb:2:in `require'
from ./mongrel.rb:2
from (irb):1
irb(main):002:0>

If you do irb -rubygems then it works. If you require 'rubygems' first it
works. If you do neither it blows up.

Let me know if that fixes it for you.

Zed A. Shaw
http://www.zedshaw.com/


> On 2/3/06, Tanner Burson <(E-Mail Removed)> wrote:
>> Like Daniel Sheppard in the previous version I'm getting errors when
>> attempting the following on windows:
>>
>> irb(main):001:0> require_gem 'mongrel'
>> =3D> true
>> irb(main):002:0> p Mongrel
>> NameError: uninitialized constant Mongrel
>> from (irb):2
>> irb(main):003:0>
>>
>> Looking at the gem install itself, everything seems to have been creat=

ed
>> correctly. I have a mongrel.rb in mongrel's lib dir, just can't seem =

to
>> get it to actually LOAD correctly. Any help would be great.
>>
>>

>
> Sorry for the double post, but as it turns out I get an Identical error=

on
> my Debian box as well, so something in the install seems to be a bit
> fubar'd.
>
> --
> =3D=3D=3DTanner Burson=3D=(E-Mail Removed)
> http://tannerburson.com <---Might even work one day...
>





 
Reply With Quote
 
Tanner Burson
Guest
Posts: n/a
 
      02-03-2006
------=_Part_5443_20537718.1138979230548
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 2/3/06, (E-Mail Removed) <(E-Mail Removed)> wrote:
>
> Did you make sure to require rubygems first? Here's my install:
>
> [zedshaw@dinky ~]$ irb -rubygems
> irb(main):001:0> require 'mongrel'
> =3D> true
> irb(main):002:0>
> [zedshaw@dinky ~]$
> irb(main):001:0> require 'rubygems'
> =3D> true
> irb(main):002:0> require 'mongrel'
> =3D> true
> [zedshaw@dinky ~]$ irb
> irb(main):001:0> require 'mongrel'
> LoadError: no such file to load -- http11
> from ./mongrel.rb:2:in `require'
> from ./mongrel.rb:2
> from (irb):1
> irb(main):002:0>
>
> If you do irb -rubygems then it works. If you require 'rubygems' first it
> works. If you do neither it blows up.
>
> Let me know if that fixes it for you.
>
> Zed A. Shaw
> http://www.zedshaw.com/



Nope, different error now. (Other gems work just fine, so I don't think
it's my gem install)

irb(main):001:0> require 'rubygems'
=3D> true
irb(main):002:0> require 'mongrel'
NameError: uninitialized constant Mongrel
from ./mongrel.rb:4
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require=
'
from (irb):2
irb(main):003:0>



> On 2/3/06, Tanner Burson <(E-Mail Removed)> wrote:
> >> Like Daniel Sheppard in the previous version I'm getting errors when
> >> attempting the following on windows:
> >>
> >> irb(main):001:0> require_gem 'mongrel'
> >> =3D> true
> >> irb(main):002:0> p Mongrel
> >> NameError: uninitialized constant Mongrel
> >> from (irb):2
> >> irb(main):003:0>
> >>
> >> Looking at the gem install itself, everything seems to have been

> created
> >> correctly. I have a mongrel.rb in mongrel's lib dir, just can't seem

> to
> >> get it to actually LOAD correctly. Any help would be great.
> >>
> >>

> >
> > Sorry for the double post, but as it turns out I get an Identical error

> on
> > my Debian box as well, so something in the install seems to be a bit
> > fubar'd.
> >
> > --
> > =3D=3D=3DTanner Burson=3D=(E-Mail Removed)
> > http://tannerburson.com <---Might even work one day...
> >

>
>
>
>



--
=3D=3D=3DTanner Burson=3D=3D=3D
(E-Mail Removed)
http://tannerburson.com <---Might even work one day...

------=_Part_5443_20537718.1138979230548--


 
Reply With Quote
 
Sascha Ebach
Guest
Posts: n/a
 
      02-03-2006
> * Fixed a header so that win32 folks can build it.

What do I need to try to build it on win32? Can someone point me to the
right compiler?

-Sascha Ebach


 
Reply With Quote
 
Massimo Maria Ghisalberti
Guest
Posts: n/a
 
      02-03-2006
Sascha Ebach wrote:
>> * Fixed a header so that win32 folks can build it.

>
> What do I need to try to build it on win32? Can someone point me to the
> right compiler?
>
> -Sascha Ebach
>
>

Microsoft Visual C++ Toolkit 2003
http://msdn.microsoft.com/visualc/vctoolkit2003/
 
Reply With Quote
 
zedshaw@zedshaw.com
Guest
Posts: n/a
 
      02-03-2006
> On 2/3/06, (E-Mail Removed) <(E-Mail Removed)> wrote:
>>
>> Did you make sure to require rubygems first? Here's my install:

<snip>

> Nope, different error now. (Other gems work just fine, so I don't thin=

k
> it's my gem install)
>
> irb(main):001:0> require 'rubygems'
> =3D> true
> irb(main):002:0> require 'mongrel'
> NameError: uninitialized constant Mongrel
> from ./mongrel.rb:4
> from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
> `require'
> from (irb):2
> irb(main):003:0>


Are you sure that you don't have any previous versions of Mongrel
installed via source? Or is ./mongrel.rb a file you're working on that's
getting loaded when you do require? The reason I ask is "from
/mongrel.rb:4" means that you're trying to use Mongrel modules at line 4=
 
Reply With Quote
 
Tanner Burson
Guest
Posts: n/a
 
      02-06-2006
------=_Part_30659_15310706.1139239961260
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 2/3/06, (E-Mail Removed) <(E-Mail Removed)> wrote:
>
> > On 2/3/06, (E-Mail Removed) <(E-Mail Removed)> wrote:
> >>
> >> Did you make sure to require rubygems first? Here's my install:

> <snip>
>
> > Nope, different error now. (Other gems work just fine, so I don't thin=

k
> > it's my gem install)
> >
> > irb(main):001:0> require 'rubygems'
> > =3D> true
> > irb(main):002:0> require 'mongrel'
> > NameError: uninitialized constant Mongrel
> > from ./mongrel.rb:4
> > from
> > /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
> > `require'
> > from (irb):2
> > irb(main):003:0>

>
> Are you sure that you don't have any previous versions of Mongrel
> installed via source? Or is ./mongrel.rb a file you're working on that's
> getting loaded when you do require? The reason I ask is "from
> ./mongrel.rb:4" means that you're trying to use Mongrel modules at line 4=

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mongrel service vs mongrel in command shell rabarama Ruby 1 12-15-2009 12:46 PM
[ANN] Mongrel Web Server 0.3.12.2 -- Iron Mongrel (Parser Fix) Zed Shaw Ruby 8 04-05-2006 06:32 AM
Mongrel Web Server 0.3.12.1 -- Iron Mongrel Zed Shaw Ruby 3 04-05-2006 06:31 AM
[ANN] Mongrel 0.2.1 HTTP Library (Fancy URI Matching) Zed Shaw Ruby 3 02-02-2006 08:58 PM
[ANN] Mongrel HTTP Library 0.2.0 (Fast And RubyForgified) Zed Shaw Ruby 9 02-02-2006 07:22 PM



Advertisments