source: Dev/trunk/d3/lib/env-js/envjs/johnson.rb @ 76

Last change on this file since 76 was 76, checked in by fpvanagthoven, 14 years ago

d3

File size: 657 bytes
Line 
1require 'johnson'
2require 'net/http'
3require 'uri'
4require 'thread'
5
6include Config
7
8def configure_context(context)
9  context['global']    = context
10  context['HTTPConnection'] = HTTPConnection.new
11end
12
13class HTTPConnection
14  def go(connection, request, headers, data)
15    headers.each{|key,value| request.add_field(key,value)}
16    response, body = connection.request(request, data)
17    respheaders = Hash.new
18    response.each_header do |name, value|
19      respheaders.store(name, value)
20    end
21    response['body'] = body
22    [response, respheaders]
23  end
24end
25
26global = Johnson::Runtime.new
27configure_context(global)
28envjs = ARGV[0]
29global.load(envjs)
30
31
Note: See TracBrowser for help on using the repository browser.