Proxy Server: Getting IronRuby Working

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: ,

Published by

Julian Birch

Full time dad, does a bit of coding on the side.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s