Line | |
---|
1 | require 'johnson' |
---|
2 | require 'net/http' |
---|
3 | require 'uri' |
---|
4 | require 'thread' |
---|
5 | |
---|
6 | include Config |
---|
7 | |
---|
8 | def configure_context(context) |
---|
9 | context['global'] = context |
---|
10 | context['HTTPConnection'] = HTTPConnection.new |
---|
11 | end |
---|
12 | |
---|
13 | class 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 |
---|
24 | end |
---|
25 | |
---|
26 | global = Johnson::Runtime.new |
---|
27 | configure_context(global) |
---|
28 | envjs = ARGV[0] |
---|
29 | global.load(envjs) |
---|
30 | |
---|
31 | |
---|
Note: See
TracBrowser
for help on using the repository browser.