dkastner-httparty 0.9.0

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.
Files changed (80) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +8 -0
  3. data/Gemfile +15 -0
  4. data/Guardfile +16 -0
  5. data/History +293 -0
  6. data/MIT-LICENSE +20 -0
  7. data/README.md +79 -0
  8. data/Rakefile +15 -0
  9. data/bin/httparty +114 -0
  10. data/cucumber.yml +1 -0
  11. data/examples/aaws.rb +32 -0
  12. data/examples/basic.rb +32 -0
  13. data/examples/crack.rb +19 -0
  14. data/examples/custom_parsers.rb +67 -0
  15. data/examples/delicious.rb +37 -0
  16. data/examples/google.rb +16 -0
  17. data/examples/headers_and_user_agents.rb +6 -0
  18. data/examples/nokogiri_html_parser.rb +22 -0
  19. data/examples/rubyurl.rb +14 -0
  20. data/examples/tripit_sign_in.rb +33 -0
  21. data/examples/twitter.rb +31 -0
  22. data/examples/whoismyrep.rb +10 -0
  23. data/features/basic_authentication.feature +20 -0
  24. data/features/command_line.feature +7 -0
  25. data/features/deals_with_http_error_codes.feature +26 -0
  26. data/features/digest_authentication.feature +20 -0
  27. data/features/handles_compressed_responses.feature +19 -0
  28. data/features/handles_multiple_formats.feature +34 -0
  29. data/features/steps/env.rb +22 -0
  30. data/features/steps/httparty_response_steps.rb +26 -0
  31. data/features/steps/httparty_steps.rb +27 -0
  32. data/features/steps/mongrel_helper.rb +94 -0
  33. data/features/steps/remote_service_steps.rb +69 -0
  34. data/features/supports_redirection.feature +22 -0
  35. data/features/supports_timeout_option.feature +13 -0
  36. data/httparty.gemspec +24 -0
  37. data/lib/httparty.rb +503 -0
  38. data/lib/httparty/connection_adapter.rb +116 -0
  39. data/lib/httparty/cookie_hash.rb +22 -0
  40. data/lib/httparty/core_extensions.rb +32 -0
  41. data/lib/httparty/exceptions.rb +26 -0
  42. data/lib/httparty/hash_conversions.rb +51 -0
  43. data/lib/httparty/module_inheritable_attributes.rb +44 -0
  44. data/lib/httparty/net_digest_auth.rb +84 -0
  45. data/lib/httparty/parser.rb +145 -0
  46. data/lib/httparty/request.rb +243 -0
  47. data/lib/httparty/response.rb +62 -0
  48. data/lib/httparty/response/headers.rb +31 -0
  49. data/lib/httparty/version.rb +3 -0
  50. data/spec/fixtures/delicious.xml +23 -0
  51. data/spec/fixtures/empty.xml +0 -0
  52. data/spec/fixtures/google.html +3 -0
  53. data/spec/fixtures/ssl/generate.sh +29 -0
  54. data/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
  55. data/spec/fixtures/ssl/generated/bogushost.crt +13 -0
  56. data/spec/fixtures/ssl/generated/ca.crt +16 -0
  57. data/spec/fixtures/ssl/generated/ca.key +15 -0
  58. data/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
  59. data/spec/fixtures/ssl/generated/server.crt +13 -0
  60. data/spec/fixtures/ssl/generated/server.key +15 -0
  61. data/spec/fixtures/ssl/openssl-exts.cnf +9 -0
  62. data/spec/fixtures/twitter.json +1 -0
  63. data/spec/fixtures/twitter.xml +403 -0
  64. data/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
  65. data/spec/httparty/connection_adapter_spec.rb +206 -0
  66. data/spec/httparty/cookie_hash_spec.rb +70 -0
  67. data/spec/httparty/net_digest_auth_spec.rb +115 -0
  68. data/spec/httparty/parser_spec.rb +171 -0
  69. data/spec/httparty/request_spec.rb +507 -0
  70. data/spec/httparty/response_spec.rb +214 -0
  71. data/spec/httparty/ssl_spec.rb +62 -0
  72. data/spec/httparty_spec.rb +703 -0
  73. data/spec/spec.opts +2 -0
  74. data/spec/spec_helper.rb +30 -0
  75. data/spec/support/ssl_test_helper.rb +47 -0
  76. data/spec/support/ssl_test_server.rb +80 -0
  77. data/spec/support/stub_response.rb +43 -0
  78. data/website/css/common.css +47 -0
  79. data/website/index.html +73 -0
  80. metadata +190 -0
@@ -0,0 +1,243 @@
1
+ module HTTParty
2
+ class Request #:nodoc:
3
+ SupportedHTTPMethods = [
4
+ Net::HTTP::Get,
5
+ Net::HTTP::Post,
6
+ Net::HTTP::Patch,
7
+ Net::HTTP::Put,
8
+ Net::HTTP::Delete,
9
+ Net::HTTP::Head,
10
+ Net::HTTP::Options
11
+ ]
12
+
13
+ SupportedURISchemes = [URI::HTTP, URI::HTTPS]
14
+
15
+ NON_RAILS_QUERY_STRING_NORMALIZER = Proc.new do |query|
16
+ Array(query).map do |key, value|
17
+ if value.nil?
18
+ key.to_s
19
+ elsif value.is_a?(Array)
20
+ value.map {|v| "#{key}=#{URI.encode(v.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))}"}
21
+ else
22
+ HashConversions.to_params(key => value)
23
+ end
24
+ end.flatten.sort.join('&')
25
+ end
26
+
27
+ attr_accessor :http_method, :path, :options, :last_response, :redirect, :last_uri
28
+
29
+ def initialize(http_method, path, o={})
30
+ self.http_method = http_method
31
+ self.path = path
32
+ self.options = {
33
+ :limit => o.delete(:no_follow) ? 1 : 5,
34
+ :default_params => {},
35
+ :follow_redirects => true,
36
+ :parser => Parser,
37
+ :connection_adapter => ConnectionAdapter
38
+ }.merge(o)
39
+ end
40
+
41
+ def path=(uri)
42
+ begin
43
+ @path = URI.parse(uri)
44
+ rescue URI::InvalidURIError
45
+ @path = URI.parse(URI.encode(uri))
46
+ end
47
+ end
48
+
49
+ def uri
50
+ new_uri = path.relative? ? URI.parse("#{base_uri}#{path}") : path
51
+
52
+ # avoid double query string on redirects [#12]
53
+ unless redirect
54
+ new_uri.query = query_string(new_uri)
55
+ end
56
+
57
+ unless SupportedURISchemes.include? new_uri.class
58
+ raise UnsupportedURIScheme, "'#{new_uri}' Must be HTTP or HTTPS"
59
+ end
60
+
61
+ @last_uri = new_uri
62
+ end
63
+
64
+ def base_uri
65
+ redirect ? "#{@last_uri.scheme}://#{@last_uri.host}" : options[:base_uri]
66
+ end
67
+
68
+ def format
69
+ options[:format] || (format_from_mimetype(last_response['content-type']) if last_response)
70
+ end
71
+
72
+ def parser
73
+ options[:parser]
74
+ end
75
+
76
+ def connection_adapter
77
+ options[:connection_adapter]
78
+ end
79
+
80
+ def perform(&block)
81
+ validate
82
+ setup_raw_request
83
+ chunked_body = nil
84
+
85
+ self.last_response = http.request(@raw_request) do |http_response|
86
+ if block
87
+ chunks = []
88
+
89
+ http_response.read_body do |fragment|
90
+ chunks << fragment
91
+ block.call(fragment)
92
+ end
93
+
94
+ chunked_body = chunks.join
95
+ end
96
+ end
97
+
98
+ handle_deflation
99
+ handle_response(chunked_body)
100
+ end
101
+
102
+ private
103
+
104
+ def http
105
+ connection_adapter.call(uri, options)
106
+ end
107
+
108
+ def body
109
+ options[:body].is_a?(Hash) ? normalize_query(options[:body]) : options[:body]
110
+ end
111
+
112
+ def credentials
113
+ options[:basic_auth] || options[:digest_auth]
114
+ end
115
+
116
+ def username
117
+ credentials[:username]
118
+ end
119
+
120
+ def password
121
+ credentials[:password]
122
+ end
123
+
124
+ def normalize_query(query)
125
+ if query_string_normalizer
126
+ query_string_normalizer.call(query)
127
+ else
128
+ HashConversions.to_params(query)
129
+ end
130
+ end
131
+
132
+ def query_string_normalizer
133
+ options[:query_string_normalizer]
134
+ end
135
+
136
+ def setup_raw_request
137
+ @raw_request = http_method.new(uri.request_uri)
138
+ @raw_request.body = body if body
139
+ @raw_request.initialize_http_header(options[:headers])
140
+ @raw_request.basic_auth(username, password) if options[:basic_auth]
141
+ setup_digest_auth if options[:digest_auth]
142
+ end
143
+
144
+ def setup_digest_auth
145
+ auth_request = http_method.new(uri.request_uri)
146
+ auth_request.initialize_http_header(options[:headers])
147
+ res = http.request(auth_request)
148
+
149
+ if res['www-authenticate'] != nil && res['www-authenticate'].length > 0
150
+ @raw_request.digest_auth(username, password, res)
151
+ end
152
+ end
153
+
154
+ def query_string(uri)
155
+ query_string_parts = []
156
+ query_string_parts << uri.query unless uri.query.nil?
157
+
158
+ if options[:query].is_a?(Hash)
159
+ query_string_parts << normalize_query(options[:default_params].merge(options[:query]))
160
+ else
161
+ query_string_parts << normalize_query(options[:default_params]) unless options[:default_params].empty?
162
+ query_string_parts << options[:query] unless options[:query].nil?
163
+ end
164
+
165
+ query_string_parts.size > 0 ? query_string_parts.join('&') : nil
166
+ end
167
+
168
+ def handle_response(body)
169
+ if response_redirects?
170
+ options[:limit] -= 1
171
+ self.path = last_response['location']
172
+ self.redirect = true
173
+ self.http_method = Net::HTTP::Get unless options[:maintain_method_across_redirects]
174
+ capture_cookies(last_response)
175
+ perform
176
+ else
177
+ body = body || last_response.body
178
+ Response.new(self, last_response, lambda { parse_response(body) }, :body => body)
179
+ end
180
+ end
181
+
182
+ # Inspired by Ruby 1.9
183
+ def handle_deflation
184
+ case last_response["content-encoding"]
185
+ when "gzip", "x-gzip"
186
+ body_io = StringIO.new(last_response.body)
187
+ last_response.body.replace Zlib::GzipReader.new(body_io).read
188
+ last_response.delete('content-encoding')
189
+ when "deflate"
190
+ last_response.body.replace Zlib::Inflate.inflate(last_response.body)
191
+ last_response.delete('content-encoding')
192
+ end
193
+ end
194
+
195
+ def response_redirects?
196
+ case last_response
197
+ when Net::HTTPMultipleChoice, # 300
198
+ Net::HTTPMovedPermanently, # 301
199
+ Net::HTTPFound, # 302
200
+ Net::HTTPSeeOther, # 303
201
+ Net::HTTPUseProxy, # 305
202
+ Net::HTTPTemporaryRedirect
203
+ options[:follow_redirects] && last_response.key?('location')
204
+ end
205
+ end
206
+
207
+ def parse_response(body)
208
+ parser.call(body, format)
209
+ end
210
+
211
+ def capture_cookies(response)
212
+ return unless response['Set-Cookie']
213
+ cookies_hash = HTTParty::CookieHash.new()
214
+ cookies_hash.add_cookies(options[:headers]['Cookie']) if options[:headers] && options[:headers]['Cookie']
215
+ cookies_hash.add_cookies(response['Set-Cookie'])
216
+ options[:headers] ||= {}
217
+ options[:headers]['Cookie'] = cookies_hash.to_cookie_string
218
+ end
219
+
220
+ # Uses the HTTP Content-Type header to determine the format of the
221
+ # response It compares the MIME type returned to the types stored in the
222
+ # SupportedFormats hash
223
+ def format_from_mimetype(mimetype)
224
+ if mimetype && parser.respond_to?(:format_from_mimetype)
225
+ parser.format_from_mimetype(mimetype)
226
+ end
227
+ end
228
+
229
+ def validate
230
+ raise HTTParty::RedirectionTooDeep.new(last_response), 'HTTP redirects too deep' if options[:limit].to_i <= 0
231
+ raise ArgumentError, 'only get, post, patch, put, delete, head, and options methods are supported' unless SupportedHTTPMethods.include?(http_method)
232
+ raise ArgumentError, ':headers must be a hash' if options[:headers] && !options[:headers].is_a?(Hash)
233
+ raise ArgumentError, 'only one authentication method, :basic_auth or :digest_auth may be used at a time' if options[:basic_auth] && options[:digest_auth]
234
+ raise ArgumentError, ':basic_auth must be a hash' if options[:basic_auth] && !options[:basic_auth].is_a?(Hash)
235
+ raise ArgumentError, ':digest_auth must be a hash' if options[:digest_auth] && !options[:digest_auth].is_a?(Hash)
236
+ raise ArgumentError, ':query must be hash if using HTTP Post' if post? && !options[:query].nil? && !options[:query].is_a?(Hash)
237
+ end
238
+
239
+ def post?
240
+ Net::HTTP::Post == http_method
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,62 @@
1
+ module HTTParty
2
+ class Response < HTTParty::BasicObject #:nodoc:
3
+ def self.underscore(string)
4
+ string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').downcase
5
+ end
6
+
7
+ attr_reader :request, :response, :body, :headers
8
+
9
+ def initialize(request, response, parsed_block, options={})
10
+ @request = request
11
+ @response = response
12
+ @body = response.body || options[:body]
13
+ @parsed_block = parsed_block
14
+ @headers = Headers.new(response.to_hash)
15
+ end
16
+
17
+ def parsed_response
18
+ @parsed_response ||= @parsed_block.call
19
+ end
20
+
21
+ def class
22
+ Response
23
+ end
24
+
25
+ def code
26
+ response.code.to_i
27
+ end
28
+
29
+ def inspect
30
+ inspect_id = "%x" % (object_id * 2)
31
+ %(#<#{self.class}:0x#{inspect_id} parsed_response=#{parsed_response.inspect}, @response=#{response.inspect}, @headers=#{headers.inspect}>)
32
+ end
33
+
34
+ CODES_TO_OBJ = ::Net::HTTPResponse::CODE_CLASS_TO_OBJ.merge ::Net::HTTPResponse::CODE_TO_OBJ
35
+
36
+ CODES_TO_OBJ.each do |response_code, klass|
37
+ name = klass.name.sub("Net::HTTP", '')
38
+ define_method("#{underscore(name)}?") do
39
+ klass === response
40
+ end
41
+ end
42
+
43
+ def respond_to?(name)
44
+ return true if [:request, :response, :parsed_response, :body, :headers].include?(name)
45
+ parsed_response.respond_to?(name) || response.respond_to?(name)
46
+ end
47
+
48
+ protected
49
+
50
+ def method_missing(name, *args, &block)
51
+ if parsed_response.respond_to?(name)
52
+ parsed_response.send(name, *args, &block)
53
+ elsif response.respond_to?(name)
54
+ response.send(name, *args, &block)
55
+ else
56
+ super
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ require 'httparty/response/headers'
@@ -0,0 +1,31 @@
1
+ module HTTParty
2
+ class Response #:nodoc:
3
+ class Headers
4
+ include ::Net::HTTPHeader
5
+
6
+ def initialize(header = {})
7
+ @header = header
8
+ end
9
+
10
+ def ==(other)
11
+ @header == other
12
+ end
13
+
14
+ def inspect
15
+ @header.inspect
16
+ end
17
+
18
+ def method_missing(name, *args, &block)
19
+ if @header.respond_to?(name)
20
+ @header.send(name, *args, &block)
21
+ else
22
+ super
23
+ end
24
+ end
25
+
26
+ def respond_to?(method)
27
+ super || @header.respond_to?(method)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ module HTTParty
2
+ VERSION = "0.9.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ <posts user="jnunemaker" tag="ruby">
2
+ <post href="http://roxml.rubyforge.org/" hash="19bba2ab667be03a19f67fb67dc56917" description="ROXML - Ruby Object to XML Mapping Library" tag="ruby xml gems mapping" time="2008-08-09T05:24:20Z" others="56" extended="ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML. Using simple annotations, it enables Ruby classes to be custom-mapped to XML. ROXML takes care of the marshalling and unmarshalling of mapped attributes so that developers can focus on building first-class Ruby classes."/>
3
+ <post href="http://code.google.com/p/sparrow/" hash="1df8a7cb9e8960992556518c0ea0d146" description="sparrow - Google Code" tag="ruby sparrow memcache queue" time="2008-08-06T15:07:24Z" others="115" extended="Sparrow is a really fast lightweight queue written in Ruby that speaks memcache. That means you can use Sparrow with any memcached client library (Ruby or otherwise)."/>
4
+ <post href="http://code.google.com/p/query-reviewer/" hash="963187e8bf350ae42e21eee13a2bef07" description="query-reviewer - Google Code" tag="rails ruby railstips plugins database optimization" time="2008-08-04T21:50:14Z" others="180" extended="This rails plugin not only runs &quot;EXPLAIN&quot; before each of your select queries in development, but provides a small DIV in the rendered output of each page with the summary of query warnings that it analyzed."/>
5
+ <post href="http://dev.zeraweb.com/introducing-functor" hash="2cdd545934bd37ae6f4829c51b3041c5" description="dev.zeraweb.com: Introducing Functor" tag="ruby methods gems railstips" time="2008-08-04T21:46:47Z" others="61" extended="Really cool ruby lib for overloading method definitions. I can think of a few places this would be handy."/>
6
+ <post href="http://prawn.majesticseacreature.com/" hash="92764e019de7553b4cd38017e42e4aaa" description="prawn.majesticseacreature.com" tag="pdf ruby railstips" time="2008-08-04T21:26:20Z" others="237" extended="pure ruby pdf generation library."/>
7
+ <post href="http://meme-rocket.com/2006/09/28/ruby-moduleinclude-at-odds-with-duck-typing/" hash="4ce96c7c237161819e9625737c22b462" description="Bill Burcham’s memeRocket :: Ruby Module#include at Odds with Duck Typing." tag="ruby railstips enumerable comparable" time="2008-08-03T16:09:24Z" others="3" extended="How to build your own enumerable and comparable objects in ruby. This article is old but just came across it and found it handy."/>
8
+ <post href="http://bl.ogtastic.com/archives/2008/7" hash="6bebd138c037d7d7c88a7046ca03f671" description="The right way to do something you should never do" tag="juggernaut observers rails flash ruby" time="2008-08-03T03:50:58Z" others="0" extended="Example of how to use juggernaut with an observer."/>
9
+ <post href="http://ncavig.com/blog/?page_id=8" hash="55450d103d6e2dd609b203ad133d751f" description="Nic’s Notions » Juggernaut Tutorials" tag="juggernaut rails ruby flash plugins server chat" time="2008-08-03T02:26:39Z" others="30" extended="Several juggernaut tutorials."/>
10
+ <post href="http://blog.labnotes.org/2008/05/05/distributed-twitter-client-in-20-lines-of-code/" hash="7c2a36292db109b144036a02eb3f46b7" description="Labnotes » Distributed Twitter Client in 20 lines of code" tag="xmpp ruby jabber xmpp4r" time="2008-08-01T18:16:23Z" others="18" extended="Cool little snippet of xmpp goodness to check your buddies status messages."/>
11
+ <post href="http://labs.reevoo.com/plugins/beanstalk-messaging" hash="d100c10208acbf5e954320a5577838d9" description="reevoolabs - Beanstalk Messaging" tag="railstips messaging queue rails ruby" time="2008-07-28T02:57:00Z" others="33" extended="Good write up on beanstalk"/>
12
+ <post href="http://www.slideshare.net/guest807bb2/rubyfringe?src=embed" hash="c3dc3b940dbe25e39737240b4e1ab071" description="Rockstar Memcached" tag="memcached performance caching ruby rails railstips" time="2008-07-28T02:30:50Z" others="11" extended="Killer presentation on memcached by Tobi of Shopify."/>
13
+ <post href="http://www.igvita.com/2008/07/22/unix-signals-for-live-debugging/" hash="288054a38d870b15bdf060ed5c6b2a2e" description="Unix Signals for Live Debugging - igvita.com" tag="ruby signals unix debugging signal railstips" time="2008-07-27T04:53:00Z" others="86" extended="I've known how to kill processes and such but never quite understood kill. Ilya Grigorik explains not only how to send those signals but how to use them in your scripts to change the way they behave on the fly. Very cool."/>
14
+ <post href="http://www.rubyinside.com/redcloth-4-released-962.html" hash="b3db9b84940ce550e26a560b83eb2f66" description="RedCloth 4.0 Released: 40x Faster Textile Rendering" tag="textile ruby gems railstips" time="2008-07-27T04:42:29Z" others="20" extended="Redcloth gets some serious love. It's now much faster. Sweet!"/>
15
+ <post href="http://code.google.com/p/rubycas-server/" hash="b532ea5933e4eba76c44823e17fecd31" description="rubycas-server - Google Code" tag="sso authentication cas ruby" time="2008-07-22T17:04:09Z" others="132" extended="RubyCAS-Server provides a single sign-on solution for web applications, implementing the server-end of JA-SIG's CAS protocol."/>
16
+ <post href="http://reinh.com/blog/2008/07/14/a-thinking-mans-sphinx.html" hash="033d72ac54d8c722618383e0e2aa18ff" description="ReinH — A Thinking Man's Sphinx" tag="rails railstips sphinx search ruby" time="2008-07-17T19:34:59Z" others="142" extended="A guide to the two sphynx plugins: ultrasphynx and thinksphynx and why you should choose one or the other."/>
17
+ <post href="http://www.rubyinside.com/ruby-xml-crisis-over-libxml-0-8-0-released-955.html" hash="70490d9786f09db5ba5f7904f88d304c" description="libxml-ruby 0.8.0 Released: Ruby Gets Fast, Reliable XML Processing At Last" tag="libxml xml ruby gems" time="2008-07-17T18:22:23Z" others="55" extended="lib xml gets an update and now it's really fast."/>
18
+ <post href="http://github.com/RISCfuture/autumn/tree/master" hash="9b47db4bf59da2009642f4084e3113a2" description="autumn at master — GitHub" tag="irc ruby gems" time="2008-07-17T18:20:19Z" others="18" extended="Easy, fresh, feature-rich IRC bots in Ruby"/>
19
+ <post href="http://groups.google.com/group/datamapper/browse_thread/thread/d33fbb20e41fad04" hash="4403898c92b37788f002ad6d79a66b68" description="New Finder Syntax (before 1.0) -" tag="railstips ruby datamapper" time="2008-07-05T20:42:27Z" others="1" extended="really cool idea for conditions in datamapper. even if you don't use datamapper, read this as it's sweet."/>
20
+ <post href="http://codeclimber.blogspot.com/2008/06/using-ruby-for-imap-with-gmail.html" hash="33bbf2492beac5fbf1fc167014060067" description="CodeClimber: using Ruby for IMAP with Gmail" tag="email gems gmail google imap rails railstips ruby" time="2008-07-05T20:06:47Z" others="118" extended="how to check gmail using ruby's IMAP libraries. the key is to use the login method instead of the authenticate one."/>
21
+ <post href="http://xullicious.blogspot.com/2008/07/updated-curb-multi-interface-patch.html" hash="f95dcc012bdc13bc26bace3ceed10656" description="Xul for thought: Updated curb multi interface patch" tag="curl ruby http" time="2008-07-03T21:52:45Z" others="1" extended="Really cool multi curl stuff to rapidly hit urls."/>
22
+ </posts>
23
+ <!-- fe04.api.del.ac4.yahoo.net uncompressed/chunked Sat Aug 9 00:20:11 PDT 2008 -->
File without changes
@@ -0,0 +1,3 @@
1
+ <html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px;padding-left:2px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z-index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>window.google={kEI:"Zuk6ScOkLKHCMrrttckF",kEXPI:"17259,19124,19314",kHL:"en"};
2
+ google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};function sf(){document.f.q.focus()}
3
+ window.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||"").value;if(c)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||"&")+"q="+encodeURIComponent(c)})};function j(a,c){a.visibility=h?"hidden":"visible";a.left=c+"px"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById("gbi"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?"iframe":"div");f.frameBorder="0";f.src="#";d.parentNode.appendChild(f).id="gbs";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className="gb2";document.onclick=b.close}if(e.className!="gb3")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+"px";f.style.height=d.offsetHeight+"px";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images)new Image().src='/images/nav_logo3.png'" topmargin=3 marginheight=3><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://images.google.com/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class=gb1>Images</a> <a href="http://maps.google.com/maps?hl=en&tab=wl" onclick=gbar.qs(this) class=gb1>Maps</a> <a href="http://news.google.com/nwshp?hl=en&tab=wn" onclick=gbar.qs(this) class=gb1>News</a> <a href="http://www.google.com/prdhp?hl=en&tab=wf" onclick=gbar.qs(this) class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.com/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" class=gb3><u>more</u> <small>&#9660;</small></a><div id=gbi> <a href="http://video.google.com/?hl=en&tab=wv" onclick=gbar.qs(this) class=gb2>Video</a> <a href="http://groups.google.com/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class=gb2>Groups</a> <a href="http://books.google.com/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class=gb2>Books</a> <a href="http://scholar.google.com/schhp?hl=en&tab=ws" onclick=gbar.qs(this) class=gb2>Scholar</a> <a href="http://finance.google.com/finance?hl=en&tab=we" onclick=gbar.qs(this) class=gb2>Finance</a> <a href="http://blogsearch.google.com/?hl=en&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.youtube.com/?hl=en&tab=w1" onclick=gbar.qs(this) class=gb2>YouTube</a> <a href="http://www.google.com/calendar/render?hl=en&tab=wc" class=gb2>Calendar</a> <a href="http://picasaweb.google.com/home?hl=en&tab=wq" onclick=gbar.qs(this) class=gb2>Photos</a> <a href="http://docs.google.com/?hl=en&tab=wo" class=gb2>Documents</a> <a href="http://www.google.com/reader/view/?hl=en&tab=wy" class=gb2>Reader</a> <a href="http://sites.google.com/?hl=en&tab=w3" class=gb2>Sites</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.com/intl/en/options/" class=gb2>even more &raquo;</a></div> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg">iGoogle</a> | <a href="https://www.google.com/accounts/Login?continue=http://www.google.com/&hl=en">Sign in</a></nobr></div><center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input type=hidden name=ie value="ISO-8859-1"><input autocomplete="off" maxlength=2048 name=q size=55 title="Google Search" value=""><br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25%><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a></font><p><font size=-2>&copy;2008 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center></body><script>if(google.y)google.y.first=[];window.setTimeout(function(){var xjs=document.createElement('script');xjs.src='/extern_js/f/CgJlbhICdXMgACswCjgMLCswDjgCLCswGDgDLA/8MIofMT_4o8.js';document.getElementsByTagName('head')[0].appendChild(xjs)},0);google.y.first.push(function(){google.ac.i(document.f,document.f.q,'','')})</script></html>
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ if [ -d "generated" ] ; then
5
+ echo >&2 "error: 'generated' directory already exists. Delete it first."
6
+ exit 1
7
+ fi
8
+
9
+ mkdir generated
10
+
11
+ # Generate the CA private key and certificate
12
+ openssl req -batch -subj '/CN=INSECURE Test Certificate Authority' -newkey rsa:1024 -new -x509 -days 999999 -keyout generated/ca.key -nodes -out generated/ca.crt
13
+
14
+ # Create symlinks for ssl_ca_path
15
+ c_rehash generated
16
+
17
+ # Generate the server private key and self-signed certificate
18
+ openssl req -batch -subj '/CN=localhost' -newkey rsa:1024 -new -x509 -days 999999 -keyout generated/server.key -nodes -out generated/selfsigned.crt
19
+
20
+ # Generate certificate signing request with bogus hostname
21
+ openssl req -batch -subj '/CN=bogo' -new -days 999999 -key generated/server.key -nodes -out generated/bogushost.csr
22
+
23
+ # Sign the certificate requests
24
+ openssl x509 -CA generated/ca.crt -CAkey generated/ca.key -set_serial 1 -in generated/selfsigned.crt -out generated/server.crt -clrext -extfile openssl-exts.cnf -extensions cert -days 999999
25
+ openssl x509 -req -CA generated/ca.crt -CAkey generated/ca.key -set_serial 1 -in generated/bogushost.csr -out generated/bogushost.crt -clrext -extfile openssl-exts.cnf -extensions cert -days 999999
26
+
27
+ # Remove certificate signing requests
28
+ rm -f generated/*.csr
29
+
@@ -0,0 +1,16 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICbTCCAdagAwIBAgIJAIAeO9TXtJ45MA0GCSqGSIb3DQEBBQUAMC4xLDAqBgNV
3
+ BAMTI0lOU0VDVVJFIFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MCAXDTEwMTAy
4
+ MDEzNDYyM1oYDzQ3NDgwOTE1MTM0NjIzWjAuMSwwKgYDVQQDEyNJTlNFQ1VSRSBU
5
+ ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
6
+ gYkCgYEA3lkBcd352qiIIzqnyvvJj59cx1dnzMyjnuaK2cRH420rBfukLE2MbOVr
7
+ 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