Proxy Server: Getting IronRuby Working

04 May 2010 13:58

Quick installation instructions:

Getting the Proxy Server Running

Annoyingly, you need to change the code from the previous post, because I used a 1.9.1 idiom: the new lambda syntax and WEBrick doesn't seem to work under IronRuby's 1.9 mode.

require 'webrick'
require 'webrick/httpproxy'

server = WEBrick::HTTPProxyServer.new(
    :Port => 8080,
    :BindAddress => '0.0.0.0',
    :ServerType => Thread,
    :RequestCallback => Proc.new {|request,response| puts "#{request.unparsed_uri}" }
)
server.start

puts "Hit return to quit"
STDIN.gets

Sure enough, the performance is perfectly fine, meaning it's likely that the whole virtual machine installation is the source of the problems.  This is unfortunate, since that was the purpose of the exercise.  It's starting to look like I may have to do a full installation onto my computer, which in turn means stopping using Notepad++.

There's a bit more about WEBrick and proxy servers here, if you can cope with the automatic smiley generator damaging the code.  There's an MSDN example of a web server as well.

Technorati Tags: ,
Comments
No comments posted yet.
Something to add?

Talking sense? Talking rubbish? Something I'm missing? Let me know!

Fields denoted with a "*" are required.

 (will not be displayed)

 
Please add 1 and 3 and type the answer here:

Preview Your Comment