[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

WEBrick for a local application?

Jeremy Bear

3/7/2005 2:41:00 AM

Hello!

I'm considering writing a dream journaling program for a small group
of friends, and we're on different platforms. I'm on Linux, one is on
FreeBSD, and others are on WindowsXP. Basically, I wanted to do
something that would yield a nice cross-platform GUI. I've looked at
using Tk, but I know that on the Linux/BSD platforms, it's rather
ugly. I thought about making a Web based gui for the program, since I
could use CSS and such to really make the interface look nice.

I've looked at the WEBrick docs and samples, and, it looks like it
could yield a decent solution. I've played around with it a little,
and I realized that starting it up at all makes an open port to the
outside world if you're online. That isn't exactly what I wanted to
do.

My main question, I guess, is this: Is there any way that I can use
WEBrick in a local setting only that will not open up a persons
computer to the outside world? I think that it could make a nice
application base, but I don't want to compromise one's security while
using it.

I really wanted to keep downloads for these people to be kept to a
minimum, so I didn't really want to make them download a bunch of
extra GUI libraries. I also wanted something that would run fairly
quick, and would be easy to use. (for some reason I have had a hard
time grasping Fox, although Tk was easy enough)

Am I barking up the wrong tree with this?

Thanks,
Jeremy


17 Answers

Joao Pedrosa

3/7/2005 2:48:00 AM

0

Hi,

On Mon, 7 Mar 2005 11:41:05 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> Hello!
>
> I'm considering writing a dream journaling program for a small group
> of friends, and we're on different platforms. I'm on Linux, one is on
> FreeBSD, and others are on WindowsXP. Basically, I wanted to do
> something that would yield a nice cross-platform GUI. I've looked at
> using Tk, but I know that on the Linux/BSD platforms, it's rather
> ugly. I thought about making a Web based gui for the program, since I
> could use CSS and such to really make the interface look nice.
>
> I've looked at the WEBrick docs and samples, and, it looks like it
> could yield a decent solution. I've played around with it a little,
> and I realized that starting it up at all makes an open port to the
> outside world if you're online. That isn't exactly what I wanted to
> do.
>
> My main question, I guess, is this: Is there any way that I can use
> WEBrick in a local setting only that will not open up a persons
> computer to the outside world? I think that it could make a nice
> application base, but I don't want to compromise one's security while
> using it.
>
> I really wanted to keep downloads for these people to be kept to a
> minimum, so I didn't really want to make them download a bunch of
> extra GUI libraries. I also wanted something that would run fairly
> quick, and would be easy to use. (for some reason I have had a hard
> time grasping Fox, although Tk was easy enough)
>
> Am I barking up the wrong tree with this?

WEBrick rocks.

You can use :BindAddress => local_ip and it will be LAN accessible only. Like:

:BindAddress => 192.168.0.100, :Port => 2000

See its code, as I use Wee and its a bit different, like:
Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
'192.168.0.100', :Port => 2000)

Cheers,
Joao


vruz

3/7/2005 2:49:00 AM

0

> My main question, I guess, is this: Is there any way that I can use
> WEBrick in a local setting only that will not open up a persons
> computer to the outside world? I think that it could make a nice
> application base, but I don't want to compromise one's security while
> using it.

Bind the webserver to the 127.0.0.1 IP address and it will be only
accesible from the local host

Web-based applications are very common nowadays, I don't think anyone
will be surprised by that.

cheers,
vruz


Joao Pedrosa

3/7/2005 2:56:00 AM

0

Hi,

On Sun, 6 Mar 2005 23:47:49 -0300, Joao Pedrosa <joaopedrosa@gmail.com> wrote:
> Hi,
>
> On Mon, 7 Mar 2005 11:41:05 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> > Hello!
> >
> > I'm considering writing a dream journaling program for a small group
> > of friends, and we're on different platforms. I'm on Linux, one is on
> > FreeBSD, and others are on WindowsXP. Basically, I wanted to do
> > something that would yield a nice cross-platform GUI. I've looked at
> > using Tk, but I know that on the Linux/BSD platforms, it's rather
> > ugly. I thought about making a Web based gui for the program, since I
> > could use CSS and such to really make the interface look nice.
> >
> > I've looked at the WEBrick docs and samples, and, it looks like it
> > could yield a decent solution. I've played around with it a little,
> > and I realized that starting it up at all makes an open port to the
> > outside world if you're online. That isn't exactly what I wanted to
> > do.
> >
> > My main question, I guess, is this: Is there any way that I can use
> > WEBrick in a local setting only that will not open up a persons
> > computer to the outside world? I think that it could make a nice
> > application base, but I don't want to compromise one's security while
> > using it.
> >
> > I really wanted to keep downloads for these people to be kept to a
> > minimum, so I didn't really want to make them download a bunch of
> > extra GUI libraries. I also wanted something that would run fairly
> > quick, and would be easy to use. (for some reason I have had a hard
> > time grasping Fox, although Tk was easy enough)
> >
> > Am I barking up the wrong tree with this?
>
> WEBrick rocks.
>
> You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
>
> :BindAddress => 192.168.0.100, :Port => 2000
>
> See its code, as I use Wee and its a bit different, like:
> Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> '192.168.0.100', :Port => 2000)

I could have asked, do you know Wee already? It's very capable in
delivering Web-Apps. After a day or so you will have your solution
partly done already.

See: http://rubyforge.org/pro...

WEBrick is its main backend so far.

Cheers,
Joao


Jeremy Bear

3/7/2005 3:09:00 AM

0

> > My main question, I guess, is this: Is there any way that I can use
> > WEBrick in a local setting only that will not open up a persons
> > computer to the outside world?
>
> WEBrick rocks.
>
> You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
>
> :BindAddress => 192.168.0.100, :Port => 2000
>
> See its code, as I use Wee and its a bit different, like:
> Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> '192.168.0.100', :Port => 2000)

Ah, okay. This seems simple enough. My question regarding this,
though, is: What if I don't know what they have their local IP set to?
Does it need to match their IP, or is there a more "generic" one I
can use, such as the 127.0.0.1 address that vruz mentioned, that will
work no matter what for the local host?

Thanks all for the extremely quick responses!

Jeremy


Luke Graham

3/7/2005 3:15:00 AM

0

On Mon, 7 Mar 2005 12:09:09 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> > > My main question, I guess, is this: Is there any way that I can use
> > > WEBrick in a local setting only that will not open up a persons
> > > computer to the outside world?
> >
> > WEBrick rocks.
> >
> > You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
> >
> > :BindAddress => 192.168.0.100, :Port => 2000
> >
> > See its code, as I use Wee and its a bit different, like:
> > Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> > '192.168.0.100', :Port => 2000)
>
> Ah, okay. This seems simple enough. My question regarding this,
> though, is: What if I don't know what they have their local IP set to?
> Does it need to match their IP, or is there a more "generic" one I
> can use, such as the 127.0.0.1 address that vruz mentioned, that will
> work no matter what for the local host?

127.0.0.1 is the standard loopback address, it works on windows and unix,
and most other places as well.

--
spooq


Bill Guindon

3/7/2005 3:16:00 AM

0

On Mon, 7 Mar 2005 12:09:09 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> > > My main question, I guess, is this: Is there any way that I can use
> > > WEBrick in a local setting only that will not open up a persons
> > > computer to the outside world?
> >
> > WEBrick rocks.
> >
> > You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
> >
> > :BindAddress => 192.168.0.100, :Port => 2000
> >
> > See its code, as I use Wee and its a bit different, like:
> > Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> > '192.168.0.100', :Port => 2000)
>
> Ah, okay. This seems simple enough. My question regarding this,
> though, is: What if I don't know what they have their local IP set to?
> Does it need to match their IP, or is there a more "generic" one I
> can use, such as the 127.0.0.1 address that vruz mentioned, that will
> work no matter what for the local host?

127.0.01 is the IP for 'localhost' (ie: "this machine"), so it's a
safe bet that.
The only time I could see it being an issue is if they're already
running another server of some kind on the same port (unlikely).

--
Bill Guindon (aka aGorilla)


Joao Pedrosa

3/7/2005 3:20:00 AM

0

Hi,

On Mon, 7 Mar 2005 12:09:09 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> > > My main question, I guess, is this: Is there any way that I can use
> > > WEBrick in a local setting only that will not open up a persons
> > > computer to the outside world?
> >
> > WEBrick rocks.
> >
> > You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
> >
> > :BindAddress => 192.168.0.100, :Port => 2000
> >
> > See its code, as I use Wee and its a bit different, like:
> > Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> > '192.168.0.100', :Port => 2000)
>
> Ah, okay. This seems simple enough. My question regarding this,
> though, is: What if I don't know what they have their local IP set to?
> Does it need to match their IP, or is there a more "generic" one I
> can use, such as the 127.0.0.1 address that vruz mentioned, that will
> work no matter what for the local host?

127.0.0.1 is suitable as well, but this is accessible from the same
machine only. The 192.168.0.100 approach is useful if you need the
same WEBrick shared in a LAN, as if all the three of you were somehow
connected in the same LAN, but I guess not.

Cheers,
Joao


Eko Budi Setiyo

3/7/2005 3:23:00 AM

0

Bill Guindon wrote:

>On Mon, 7 Mar 2005 12:09:09 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
>
>
>>>>My main question, I guess, is this: Is there any way that I can use
>>>>WEBrick in a local setting only that will not open up a persons
>>>>computer to the outside world?
>>>>
>>>>
>>>WEBrick rocks.
>>>
>>>You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
>>>
>>>:BindAddress => 192.168.0.100, :Port => 2000
>>>
>>>See its code, as I use Wee and its a bit different, like:
>>>Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
>>>'192.168.0.100', :Port => 2000)
>>>
>>>
>>Ah, okay. This seems simple enough. My question regarding this,
>>though, is: What if I don't know what they have their local IP set to?
>> Does it need to match their IP, or is there a more "generic" one I
>>can use, such as the 127.0.0.1 address that vruz mentioned, that will
>>work no matter what for the local host?
>>
>>
>
>127.0.01 is the IP for 'localhost' (ie: "this machine"), so it's a
>safe bet that.
>The only time I could see it being an issue is if they're already
>running another server of some kind on the same port (unlikely).
>
>
>
Is Webrick can be use for single point of entry (every request served by
index.rb).

regards
Eko



vruz

3/7/2005 3:23:00 AM

0

> Ah, okay. This seems simple enough. My question regarding this,
> though, is: What if I don't know what they have their local IP set to?
> Does it need to match their IP, or is there a more "generic" one I
> can use, such as the 127.0.0.1 address that vruz mentioned, that will
> work no matter what for the local host?

yes, 127.0.0.1 is your safest bet.

It won't be useful if you need to access the app from other machines
in the local network though.

If you need the app to be accessible from other machines in the local
network you may have to detect the available local addresses
(generally something in the 192.168.xxx.xxx range)
but that detection is probably system-dependent.

cheers,
vruz


Jeremy Bear

3/7/2005 3:30:00 AM

0

On Mon, 7 Mar 2005 12:22:51 +0900, Eko Budi Setiyo
<contact_us@haltebis.com> wrote:
> Bill Guindon wrote:
>
> >On Mon, 7 Mar 2005 12:09:09 +0900, Jeremy Bear <jeremy.bear@gmail.com> wrote:
> >
> >
> >>>>My main question, I guess, is this: Is there any way that I can use
> >>>>WEBrick in a local setting only that will not open up a persons
> >>>>computer to the outside world?
> >>>>
> >>>>
> >>>WEBrick rocks.
> >>>
> >>>You can use :BindAddress => local_ip and it will be LAN accessible only. Like:
> >>>
> >>>:BindAddress => 192.168.0.100, :Port => 2000
> >>>
> >>>See its code, as I use Wee and its a bit different, like:
> >>>Wee::WEBrickAdaptor.register('/app' => app).start(:BindAddress =>
> >>>'192.168.0.100', :Port => 2000)
> >>>
> >>>
> >>Ah, okay. This seems simple enough. My question regarding this,
> >>though, is: What if I don't know what they have their local IP set to?
> >> Does it need to match their IP, or is there a more "generic" one I
> >>can use, such as the 127.0.0.1 address that vruz mentioned, that will
> >>work no matter what for the local host?
> >>
> >>
> >
> >127.0.01 is the IP for 'localhost' (ie: "this machine"), so it's a
> >safe bet that.
> >The only time I could see it being an issue is if they're already
> >running another server of some kind on the same port (unlikely).
> >
> >
> >
> Is Webrick can be use for single point of entry (every request served by
> index.rb).

Eko,

The concept makes sense, but I have to admit that finding
documentation for WEBrick has been... challenging. Could you
elaborate on this a bit? What do you mean by a single point of entry?

Thanks,
Jeremy