strawman 0.3 → 0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +13 -4
- data/Rakefile +1 -1
- data/lib/strawman/http_request.rb +38 -12
- data/strawman.gemspec +2 -2
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +1 -2
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
|
-
*
|
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.
|
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
|
20
|
-
#
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
#
|
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
|
-
|
35
|
-
|
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.
|
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-
|
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.
|
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-
|
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
|
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�/�Qj�h���'�UN����J;�z}�b�dI� ||XE=�h1�RX@8��|6-,�$2���|�)o}�����¬1�y��T��t��d�d���%�澶U��x^�����})\�Z
|