strawman 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -54,11 +54,20 @@ Patches happily accepted, please open a github ticket and attach the patch.
54
54
 
55
55
  * Undo link encoding if Glype adds it
56
56
  * Strip annoying stuff that Glype adds as a footer and header
57
- * POST doesn't work
58
- * Cookies don't work
59
- * SSL doesn't work
60
57
  * Implement other proxy sources
61
58
 
62
59
  == Limitations
63
60
 
64
- * PUT and DELETE can't work do to the way Glype is implemented
61
+ * Cookies from the proxied page are returned like this:
62
+ c[DOMAIN][PATH][NAME]=VALUE; path=/"*
63
+ Note the letter c is configurable on the Glype proxy so it might not always b
64
+ this.
65
+ * Cookies are sent like this:
66
+ :head => {:cookie => {"c[DOMAIN][PATH][NAME]" => VALUE}}
67
+ Again note that the letter c is configurable on the Glype proxy.
68
+ * Cookies are currently not reliable as they can be enabled or disabled by each
69
+ Glype install (the default is to enable though).
70
+ * SSL is not reliable. Some proxies throw up a warning while others let it
71
+ through. Also it's not secure, by it's very nature this library is introducing
72
+ a MITM. Don't use it for sensitive things.
73
+ * PUT and DELETE can't work do to the way Glype is implemented.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'spec/rake/spectask'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('strawman', '0.3') do |p|
6
+ Echoe.new('strawman', '0.4') do |p|
7
7
  p.description = "Allows you fetch pages using glype proxies."
8
8
  p.url = "http://github.com/mattcolyer/strawman"
9
9
  p.author = "Matt Colyer"
@@ -16,23 +16,36 @@ module Strawman
16
16
  end
17
17
 
18
18
  #
19
- # Handles get requests. Currently it accepts no arguments (ie query
20
- # parameters, http headers etc...).
21
- #
22
- def get
23
- http = @request.get :head => {"referer" => @proxy.referer}
24
- http.callback {
25
- # TODO: Munge the return output so that the stuff added by Glype is
26
- # removed
27
- }
19
+ # Handles HTTP GET requests. Query parameters should be specified on the
20
+ # url given to HttpRequest.
21
+ #
22
+ # - opts: Takes a hash of options identical to EventMachine::HttpRequest.
23
+ #
24
+ # NOTE: most options will be ignored, except body data and proxy
25
+ # information.
26
+ #
27
+ def get(opts={})
28
+ opts = merge_referer_into_opts(opts)
29
+ http = @request.get opts
30
+ http.callback { munge_output }
28
31
  http
29
32
  end
30
33
 
31
34
  #
32
- # TODO: Implement this.
35
+ # Handles HTTP POST requests. In for the post request to be a sent as a POST
36
+ # request, atleast one POST field must be specified in the opts. Query
37
+ # parameters should be specified on the url given to HttpRequest.
33
38
  #
34
- def post
35
- raise NotImplementedError
39
+ # - opts: Takes a hash of options identical to EventMachine::HttpRequest.
40
+ #
41
+ # NOTE: most options will be ignored, except body data and proxy
42
+ # information.
43
+ #
44
+ def post(opts={})
45
+ opts = merge_referer_into_opts(opts)
46
+ http = @request.post opts
47
+ http.callback { munge_output }
48
+ http
36
49
  end
37
50
 
38
51
  #
@@ -55,5 +68,18 @@ module Strawman
55
68
  def head
56
69
  raise NotImplementedError
57
70
  end
71
+
72
+ private
73
+ def merge_referer_into_opts(opts)
74
+ if opts.has_key? :head
75
+ opts[:head].merge!({"referer" => @proxy.referer})
76
+ opts
77
+ else
78
+ opts.merge({:head => {"referer" => @proxy.referer}})
79
+ end
80
+ end
81
+
82
+ def munge_output()
83
+ end
58
84
  end
59
85
  end
data/strawman.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{strawman}
5
- s.version = "0.3"
5
+ s.version = "0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Matt Colyer"]
9
9
  s.cert_chain = ["/home/mcolyer/.ssh/gem-public_cert.pem"]
10
- s.date = %q{2010-02-19}
10
+ s.date = %q{2010-02-21}
11
11
  s.description = %q{Allows you fetch pages using glype proxies.}
12
12
  s.email = %q{matt @nospam@ colyer.name}
13
13
  s.extra_rdoc_files = ["README.rdoc", "lib/strawman.rb", "lib/strawman/http_request.rb", "lib/strawman/proxy.rb", "lib/strawman/proxy_list.rb", "lib/strawman/source.rb"]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strawman
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Colyer
@@ -30,7 +30,7 @@ cert_chain:
30
30
  anU=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2010-02-19 00:00:00 -08:00
33
+ date: 2010-02-21 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- B�¤�a���V�@� Iv�;��ZP*��TB+E�`G`���3�Ճ�P��P��6�̮���F�KkuKsj���u�oI/�UZ=qHP�}��gܪ�-2ZmHm��<\�I�/)�#ˑ�WHs���a���K�����^�CtVeH�`�$��V��Dn���.�)��C�-̍�j,�C��V�� �,��cr&�׬�l�)�(e�Å�?)���ុ=��m��9v~c��6
2
- �wLt»r5C�Ii�s��BI�B@
1
+ ,RI}�Y��E �B�L�Hr#�,��M�5�V��O�`��!���2�wdɬ�m��$�+�o��WL�lj��� �� �{�u�/�Qjh���'UN����J;�z}�b �dI ||XE=�h1�RX@8��|6-,�$2���|�)o}�����¬1�y��T��t��dd���%�澶U��x^�����})\�Z