[Mongrel] [Patch] HttpServer.port reports the bound port
luislavena at gmail.com
Mon Aug 6 17:54:02 EDT 2007
On 8/6/07, Steven Lumos <steven at lumos.us> wrote:
> "Zed A. Shaw" <zedshaw at zedshaw.com> writes:
> > On Sun, 5 Aug 2007 17:02:12 -0700
> > Corey Jewett <ml at syntheticplayground.com> wrote:
> >> This is for when you pass mongrel 0 for the port and the OS assigns
> >> an open one.
> >> Corey
> > Does that work on Windows? :-) (Gets them every time.)
> Well, they just ripped off Berkeley sockets, right?
yes and no, sockets are a bit tricky on windows, but in this case,
isolation of Ruby VM play on our side.
> This is v1.8.2 of the one-click installer. I'll bother to update it
> if anyone thinks it matters.
> irb(main):001:0> require 'socket'
> => true
> irb(main):002:0> s = TCPServer.new(0)
> => #<TCPServer:0x2dc4930>
> irb(main):003:0> s.addr
> => ["AF_INET", 1110, "0.0.0.0", "0.0.0.0"]
Confirmed, 1.8.5 behaves the same way like 1.8.2, since addr is the
Array with [Protocol, Port, ServerIP, ClientIP].
Anyway, what is the purpose of a random HTTPServer port? If you try to
open a mongrel server in an already taken port, a error must be shown,
instead of a false positive.
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
More information about the Mongrel-users