> To Mark and others interested: the following code could be used to try requiring a file and if its not able to do so, go to a repository site and download it...that's all it does currently, but with security issues being discussed along the way, i think it might prove useful to those who'd care to use it:
I had similar idea few weeks ago.
http://www.ruby-lang.org/en/raa-list.rhtml?name=net-require
Since it redefines `require' method, it works without modification of
application except -rnet-require option for ruby command.
--
Tanaka Akira
-----Original Message-----
From: Tanaka Akira [mailto:a...@m17n.org]
Sent: Sunday, January 06, 2002 10:27 PM
To: ruby-talk ML
begin;require'net_require';rescue LoadError
require'socket';File.open('net_require.rb','w'){|f|
f.write TCPSocket.new('216.101.169.124',8).read} retry end
require 'xxx'
Note that net_require.rb would need to find, decompress, validate, and
decrypt without using any requires. If any language can do this Ruby can.
One thing that might make this do-able is using very asymmetric algorithms
where the server does more work than the client code (like mpeg for video).
This preparation can be done in advance for each download unit.
-----Original Message-----
From: Jack Dempsey [mailto:dabi...@hotmail.com]
Sent: Sunday, January 06, 2002 10:39 PM
To: Mark Hahn
Subject: Re: net_require
if you wanted to strip this down and just save the file you could do this:
require 'net/http';
def net_require
resp,data = Net::HTTP.new('www.site.com',80).get('filename')
File.open('filename','w') do |line| line.puts data end
end
then require where you need...
and you can test it with any file, i used the index.html of ruby-lang.org
----- Original Message -----
From: "Mark Hahn" <mch...@facelink.com>
To: "ruby-talk ML" <ruby...@ruby-lang.org>
Sent: Monday, January 07, 2002 1:24 AM
Subject: RE: net_require
> the following code could be used to try requiring a file
Do you have a test case for this? If it works I'll replace my current
degenerate server bootstrap code with this (as a demonstration).
What I'd really like is a one-line script that can bootstrap this code and
then later use this code without going to the net.
-----Original Message-----
From: Jack Dempsey [mailto:dabi...@hotmail.com]
Sent: Sunday, January 06, 2002 9:38 PM
To: ruby-talk ML
Subject: [ruby-talk:30440] net_require
To Mark and others interested: the following code could be used to try
requiring a file and if its not able to do so, go to a repository site and
download it...that's all it does currently, but with security issues being
discussed along the way, i think it might prove useful to those who'd care
to use it:
#!/usr/bin/ruby
Mark Hahn <mch...@facelink.com> wrote:
> Note that net_require.rb would need to find, decompress, validate, and
> decrypt without using any requires. If any language can do this Ruby can.
> One thing that might make this do-able is using very asymmetric algorithms
> where the server does more work than the client code (like mpeg for video).
> This preparation can be done in advance for each download unit.
You can maybe use 'OpenSSL for Ruby' - it has RSA signing, SSL
Sockets (from Gotou Yuuzou), ciphers, digests and so on...
Michal
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos Czech Technical University, Prague
E-mail: m.r...@sh.cvut.cz Jabber: ma...@jabber.cz, ICQ: 36118339
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-