httpclient 2.3.0.1 → 2.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +85 -0
  3. data/bin/httpclient +18 -6
  4. data/bin/jsonclient +85 -0
  5. data/lib/http-access2.rb +1 -1
  6. data/lib/httpclient.rb +262 -88
  7. data/lib/httpclient/auth.rb +269 -244
  8. data/lib/httpclient/cacert.pem +3952 -0
  9. data/lib/httpclient/cacert1024.pem +3866 -0
  10. data/lib/httpclient/connection.rb +1 -1
  11. data/lib/httpclient/cookie.rb +161 -514
  12. data/lib/httpclient/http.rb +57 -21
  13. data/lib/httpclient/include_client.rb +2 -0
  14. data/lib/httpclient/jruby_ssl_socket.rb +588 -0
  15. data/lib/httpclient/session.rb +259 -317
  16. data/lib/httpclient/ssl_config.rb +141 -188
  17. data/lib/httpclient/ssl_socket.rb +150 -0
  18. data/lib/httpclient/timeout.rb +1 -1
  19. data/lib/httpclient/util.rb +62 -1
  20. data/lib/httpclient/version.rb +1 -1
  21. data/lib/httpclient/webagent-cookie.rb +459 -0
  22. data/lib/jsonclient.rb +63 -0
  23. data/lib/oauthclient.rb +2 -1
  24. data/sample/jsonclient.rb +67 -0
  25. data/sample/oauth_twitter.rb +4 -4
  26. data/test/{ca-chain.cert → ca-chain.pem} +0 -0
  27. data/test/client-pass.key +18 -0
  28. data/test/helper.rb +10 -8
  29. data/test/jruby_ssl_socket/test_pemutils.rb +32 -0
  30. data/test/test_auth.rb +175 -4
  31. data/test/test_cookie.rb +147 -243
  32. data/test/test_http-access2.rb +17 -16
  33. data/test/test_httpclient.rb +458 -77
  34. data/test/test_jsonclient.rb +80 -0
  35. data/test/test_ssl.rb +341 -17
  36. data/test/test_webagent-cookie.rb +465 -0
  37. metadata +57 -55
  38. data/README.txt +0 -721
  39. data/lib/httpclient/cacert.p7s +0 -1858
  40. data/lib/httpclient/cacert_sha1.p7s +0 -1858
  41. data/sample/oauth_salesforce_10.rb +0 -63
@@ -1,5 +1,5 @@
1
1
  # HTTPClient - HTTP client library.
2
- # Copyright (C) 2000-2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
2
+ # Copyright (C) 2000-2015 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
3
  #
4
4
  # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
5
  # redistribute it and/or modify it under the same terms of Ruby's license;
@@ -1,573 +1,220 @@
1
- # cookie.rb is redistributed file which is originally included in Webagent
2
- # version 0.6.2 by TAKAHASHI `Maki' Masayoshi. And it contains some bug fixes.
3
- # You can download the entire package of Webagent from
4
- # http://www.rubycolor.org/arc/.
1
+ # do not override if httpclient/webagent-cookie is loaded already
2
+ unless defined?(HTTPClient::CookieManager)
3
+ begin # for catching LoadError and load webagent-cookie instead
5
4
 
6
-
7
- # Cookie class
8
- #
9
- # I refered to w3m's source to make these classes. Some comments
10
- # are quoted from it. I'm thanksful for author(s) of it.
11
- #
12
- # w3m homepage: http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/eng/
13
-
14
- require 'time'
15
- require 'monitor'
5
+ require 'http-cookie'
16
6
  require 'httpclient/util'
17
7
 
18
- class WebAgent
19
-
20
- module CookieUtils
8
+ class HTTPClient
9
+ class CookieManager
10
+ include HTTPClient::Util
21
11
 
22
- def head_match?(str1, str2)
23
- str1 == str2[0, str1.length]
24
- end
12
+ attr_reader :format, :jar
13
+ attr_accessor :cookies_file
25
14
 
26
- def tail_match?(str1, str2)
27
- if str1.length > 0
28
- str1 == str2[-str1.length..-1].to_s
29
- else
30
- true
31
- end
15
+ def initialize(cookies_file = nil, format = WebAgentSaver, jar = HTTP::CookieJar.new)
16
+ @cookies_file = cookies_file
17
+ @format = format
18
+ @jar = jar
19
+ load_cookies if @cookies_file
20
+ end
21
+
22
+ def load_cookies
23
+ check_cookies_file
24
+ @jar.clear
25
+ @jar.load(@cookies_file, :format => @format)
26
+ end
27
+
28
+ def save_cookies(session = false)
29
+ check_cookies_file
30
+ @jar.save(@cookies_file, :format => @format, :session => session)
31
+ end
32
+
33
+ def cookies(uri = nil)
34
+ cookies = @jar.cookies(uri)
35
+ # TODO: return HTTP::Cookie in the future
36
+ cookies.map { |cookie|
37
+ WebAgent::Cookie.new(
38
+ :name => cookie.name,
39
+ :value => cookie.value,
40
+ :domain => cookie.domain,
41
+ :path => cookie.path,
42
+ :origin => cookie.origin,
43
+ :for_domain => cookie.for_domain,
44
+ :expires => cookie.expires,
45
+ :httponly => cookie.httponly,
46
+ :secure => cookie.secure
47
+ )
48
+ }
32
49
  end
33
50
 
34
- def domain_match(host, domain)
35
- domainname = domain.sub(/\.\z/, '').downcase
36
- hostname = host.sub(/\.\z/, '').downcase
37
- case domain
38
- when /\d+\.\d+\.\d+\.\d+/
39
- return (hostname == domainname)
40
- when '.'
41
- return true
42
- when /^\./
43
- # allows; host == rubyforge.org, domain == .rubyforge.org
44
- return tail_match?(domainname, '.' + hostname)
45
- else
46
- return (hostname == domainname)
51
+ def cookie_value(uri)
52
+ cookies = self.cookies(uri)
53
+ unless cookies.empty?
54
+ HTTP::Cookie.cookie_value(cookies)
47
55
  end
48
56
  end
49
57
 
50
- def total_dot_num(string)
51
- string.scan(/\./).length()
58
+ def parse(value, uri)
59
+ @jar.parse(value, uri)
52
60
  end
53
61
 
54
- end
55
-
56
- class Cookie
57
- include CookieUtils
58
-
59
- attr_accessor :name, :value
60
- attr_accessor :domain, :path
61
- attr_accessor :expires ## for Netscape Cookie
62
- attr_accessor :url
63
- attr_writer :use, :secure, :http_only, :discard, :domain_orig, :path_orig, :override
64
-
65
- USE = 1
66
- SECURE = 2
67
- DOMAIN = 4
68
- PATH = 8
69
- DISCARD = 16
70
- OVERRIDE = 32
71
- OVERRIDE_OK = 32
72
- HTTP_ONLY = 64
73
-
74
- def initialize()
75
- @name = @value = @domain = @path = nil
76
- @expires = nil
77
- @url = nil
78
- @use = @secure = @http_only = @discard = @domain_orig = @path_orig = @override = nil
79
- end
80
-
81
- def discard?
82
- @discard
83
- end
84
-
85
- def use?
86
- @use
87
- end
88
-
89
- def secure?
90
- @secure
91
- end
92
-
93
- def http_only?
94
- @http_only
95
- end
96
-
97
- def domain_orig?
98
- @domain_orig
99
- end
100
-
101
- def path_orig?
102
- @path_orig
62
+ def cookies=(cookies)
63
+ @jar.clear
64
+ cookies.each do |cookie|
65
+ add(cookie)
66
+ end
103
67
  end
104
68
 
105
- def override?
106
- @override
69
+ def add(cookie)
70
+ @jar.add(cookie)
107
71
  end
108
72
 
109
- def flag
110
- flg = 0
111
- flg += USE if @use
112
- flg += SECURE if @secure
113
- flg += HTTP_ONLY if @http_only
114
- flg += DOMAIN if @domain_orig
115
- flg += PATH if @path_orig
116
- flg += DISCARD if @discard
117
- flg += OVERRIDE if @override
118
- flg
73
+ def find(uri)
74
+ warning('CookieManager#find is deprecated and will be removed in near future. Use HTTP::Cookie.cookie_value(CookieManager#cookies) instead')
75
+ if cookie = cookies(uri)
76
+ HTTP::Cookie.cookie_value(cookie)
77
+ end
119
78
  end
120
79
 
121
- def set_flag(flag)
122
- flag = flag.to_i
123
- @use = true if flag & USE > 0
124
- @secure = true if flag & SECURE > 0
125
- @http_only = true if flag & HTTP_ONLY > 0
126
- @domain_orig = true if flag & DOMAIN > 0
127
- @path_orig = true if flag & PATH > 0
128
- @discard = true if flag & DISCARD > 0
129
- @override = true if flag & OVERRIDE > 0
130
- end
80
+ private
131
81
 
132
- def match?(url)
133
- domainname = url.host
134
- if (!domainname ||
135
- !domain_match(domainname, @domain) ||
136
- (@path && !head_match?(@path, url.path.empty? ? '/' : url.path)) ||
137
- (@secure && (url.scheme != 'https')) )
138
- return false
139
- else
140
- return true
82
+ def check_cookies_file
83
+ unless @cookies_file
84
+ raise ArgumentError.new('Cookies file not specified')
141
85
  end
142
86
  end
87
+ end
143
88
 
144
- def join_quotedstr(array, sep)
145
- ret = Array.new()
146
- old_elem = nil
147
- array.each{|elem|
148
- if (elem.scan(/"/).length % 2) == 0
149
- if old_elem
150
- old_elem << sep << elem
151
- else
152
- ret << elem
153
- old_elem = nil
154
- end
155
- else
156
- if old_elem
157
- old_elem << sep << elem
158
- ret << old_elem
159
- old_elem = nil
160
- else
161
- old_elem = elem.dup
162
- end
163
- end
164
- }
165
- ret
89
+ class WebAgentSaver < HTTP::CookieJar::AbstractSaver
90
+ # no option
91
+ def default_options
92
+ {}
166
93
  end
167
94
 
168
- def parse(str, url)
169
- @url = url
170
- # TODO: should not depend on join_quotedstr. scan with escape like CSV.
171
- cookie_elem = str.split(/;/)
172
- cookie_elem = join_quotedstr(cookie_elem, ';')
173
- cookie_elem -= [""] # del empty elements, a cookie might included ";;"
174
- first_elem = cookie_elem.shift
175
- if first_elem !~ /([^=]*)(\=(.*))?/
176
- return
177
- ## raise ArgumentError 'invalid cookie value'
178
- end
179
- @name = $1.strip
180
- @value = normalize_cookie_value($3)
181
- cookie_elem.each{|pair|
182
- key, value = pair.split(/=/, 2) ## value may nil
183
- key.strip!
184
- value = normalize_cookie_value(value)
185
- case key.downcase
186
- when 'domain'
187
- @domain = value
188
- when 'expires'
189
- @expires = nil
190
- begin
191
- @expires = Time.parse(value).gmtime() if value
192
- rescue ArgumentError
193
- end
194
- when 'path'
195
- @path = value
196
- when 'secure'
197
- @secure = true ## value may nil, but must 'true'.
198
- when 'httponly'
199
- @http_only = true ## value may nil, but must 'true'.
200
- else
201
- ## ignore
202
- end
95
+ # same as HTTP::CookieJar::CookiestxtSaver
96
+ def save(io, jar)
97
+ jar.each { |cookie|
98
+ next if !@session && cookie.session?
99
+ io.print cookie_to_record(cookie)
203
100
  }
204
101
  end
205
102
 
206
- def normalize_cookie_value(value)
207
- if value
208
- value = value.strip.sub(/\A"(.*)"\z/) { $1 }
209
- value = nil if value.empty?
210
- end
211
- value
103
+ # same as HTTP::CookieJar::CookiestxtSaver
104
+ def load(io, jar)
105
+ io.each_line { |line|
106
+ cookie = parse_record(line) and jar.add(cookie)
107
+ }
212
108
  end
213
- private :normalize_cookie_value
214
- end
215
109
 
216
- class CookieManager
217
- include CookieUtils
218
-
219
- ### errors
220
- class Error < StandardError; end
221
- class ErrorOverrideOK < Error; end
222
- class SpecialError < Error; end
110
+ private
223
111
 
224
- attr_reader :cookies
225
- attr_accessor :cookies_file
226
- attr_accessor :accept_domains, :reject_domains
227
-
228
- # for conformance to http://wp.netscape.com/newsref/std/cookie_spec.html
229
- attr_accessor :netscape_rule
230
- SPECIAL_DOMAIN = [".com",".edu",".gov",".mil",".net",".org",".int"]
231
-
232
- def initialize(file=nil)
233
- @cookies = Array.new()
234
- @cookies.extend(MonitorMixin)
235
- @cookies_file = file
236
- @is_saved = true
237
- @reject_domains = Array.new()
238
- @accept_domains = Array.new()
239
- @netscape_rule = false
112
+ def cookie_to_record(cookie)
113
+ [
114
+ cookie.origin,
115
+ cookie.name,
116
+ cookie.value,
117
+ cookie.expires.to_i,
118
+ cookie.dot_domain,
119
+ cookie.path,
120
+ self.class.flag(cookie)
121
+ ].join("\t") + "\n"
240
122
  end
241
123
 
242
- def cookies=(cookies)
243
- @cookies = cookies
244
- @cookies.extend(MonitorMixin)
245
- end
124
+ def parse_record(line)
125
+ return nil if /\A#/ =~ line
126
+ col = line.chomp.split(/\t/)
246
127
 
247
- def save_all_cookies(force = nil, save_unused = true, save_discarded = true)
248
- @cookies.synchronize do
249
- check_expired_cookies()
250
- if @is_saved and !force
251
- return
252
- end
253
- File.open(@cookies_file, 'w') do |f|
254
- @cookies.each do |cookie|
255
- if (cookie.use? or save_unused) and
256
- (!cookie.discard? or save_discarded)
257
- f.print(cookie.url.to_s,"\t",
258
- cookie.name,"\t",
259
- cookie.value,"\t",
260
- cookie.expires.to_i,"\t",
261
- cookie.domain,"\t",
262
- cookie.path,"\t",
263
- cookie.flag,"\n")
264
- end
265
- end
266
- end
128
+ origin = col[0]
129
+ name = col[1]
130
+ value = col[2]
131
+ value.chomp!
132
+ if col[3].empty? or col[3] == '0'
133
+ expires = nil
134
+ else
135
+ expires = Time.at(col[3].to_i)
136
+ return nil if expires < Time.now
267
137
  end
268
- @is_saved = true
269
- end
138
+ domain = col[4]
139
+ path = col[5]
270
140
 
271
- def save_cookies(force = nil)
272
- save_all_cookies(force, false, false)
141
+ cookie = WebAgent::Cookie.new(name, value,
142
+ :origin => origin,
143
+ :domain => domain,
144
+ :path => path,
145
+ :expires => expires
146
+ )
147
+ self.class.set_flag(cookie, col[6].to_i)
148
+ cookie
273
149
  end
274
150
 
275
- def check_expired_cookies()
276
- @cookies.reject!{|cookie|
277
- is_expired = (cookie.expires && (cookie.expires < Time.now.gmtime))
278
- if is_expired && !cookie.discard?
279
- @is_saved = false
280
- end
281
- is_expired
282
- }
283
- end
151
+ USE = 1
152
+ SECURE = 2
153
+ DOMAIN = 4
154
+ PATH = 8
155
+ HTTP_ONLY = 64
284
156
 
285
- def parse(str, url)
286
- cookie = WebAgent::Cookie.new()
287
- cookie.parse(str, url)
288
- add(cookie)
157
+ def self.flag(cookie)
158
+ flg = 0
159
+ flg += USE # not used
160
+ flg += SECURE if cookie.secure?
161
+ flg += DOMAIN if cookie.for_domain?
162
+ flg += HTTP_ONLY if cookie.httponly?
163
+ flg += PATH if cookie.path # not used
164
+ flg
289
165
  end
290
166
 
291
- def make_cookie_str(cookie_list)
292
- if cookie_list.empty?
293
- return nil
294
- end
295
-
296
- ret = ''
297
- c = cookie_list.shift
298
- ret += "#{c.name}=#{c.value}"
299
- cookie_list.each{|cookie|
300
- ret += "; #{cookie.name}=#{cookie.value}"
301
- }
302
- return ret
167
+ def self.set_flag(cookie, flag)
168
+ cookie.secure = true if flag & SECURE > 0
169
+ cookie.for_domain = true if flag & DOMAIN > 0
170
+ cookie.httponly = true if flag & HTTP_ONLY > 0
303
171
  end
304
- private :make_cookie_str
172
+ end
173
+ end
305
174
 
175
+ # for backward compatibility
176
+ class WebAgent
177
+ CookieManager = ::HTTPClient::CookieManager
306
178
 
307
- def find(url)
308
- return nil if @cookies.empty?
179
+ class Cookie < HTTP::Cookie
180
+ include HTTPClient::Util
309
181
 
310
- cookie_list = Array.new()
311
- @cookies.each{|cookie|
312
- is_expired = (cookie.expires && (cookie.expires < Time.now.gmtime))
313
- if cookie.use? && !is_expired && cookie.match?(url)
314
- if cookie_list.select{|c1| c1.name == cookie.name}.empty?
315
- cookie_list << cookie
316
- end
317
- end
318
- }
319
- return make_cookie_str(cookie_list)
182
+ def url
183
+ deprecated('url', 'origin')
184
+ self.origin
320
185
  end
321
186
 
322
- def find_cookie_info(domain, path, name)
323
- @cookies.find{|c|
324
- c.domain == domain && c.path == path && c.name == name
325
- }
187
+ def url=(url)
188
+ deprecated('url=', 'origin=')
189
+ self.origin = url
326
190
  end
327
- private :find_cookie_info
328
191
 
329
- # not tested well; used only netscape_rule = true.
330
- def cookie_error(err, override)
331
- if !err.kind_of?(ErrorOverrideOK) || !override
332
- raise err
333
- end
192
+ def http_only?
193
+ deprecated('http_only?', 'httponly?')
194
+ self.httponly?
334
195
  end
335
- private :cookie_error
336
-
337
- def add(cookie)
338
- url = cookie.url
339
- name, value = cookie.name, cookie.value
340
- expires, domain, path =
341
- cookie.expires, cookie.domain, cookie.path
342
- secure, http_only, domain_orig, path_orig =
343
- cookie.secure?, cookie.http_only?, cookie.domain_orig?, cookie.path_orig?
344
- discard, override =
345
- cookie.discard?, cookie.override?
346
-
347
- domainname = url.host
348
- domain_orig, path_orig = domain, path
349
-
350
- if domain
351
-
352
- # [DRAFT 12] s. 4.2.2 (does not apply in the case that
353
- # host name is the same as domain attribute for version 0
354
- # cookie)
355
- # I think that this rule has almost the same effect as the
356
- # tail match of [NETSCAPE].
357
- if domain !~ /^\./ && domainname != domain
358
- domain = '.'+domain
359
- end
360
-
361
- # [NETSCAPE] rule
362
- if @netscape_rule
363
- n = total_dot_num(domain)
364
- if n < 2
365
- cookie_error(SpecialError.new(), override)
366
- elsif n == 2
367
- ## [NETSCAPE] rule
368
- ok = SPECIAL_DOMAIN.select{|sdomain|
369
- sdomain == domain[-(sdomain.length)..-1]
370
- }
371
- if ok.empty?
372
- cookie_error(SpecialError.new(), override)
373
- end
374
- end
375
- end
376
-
377
- # this implementation does not check RFC2109 4.3.2 case 2;
378
- # the portion of host not in domain does not contain a dot.
379
- # according to nsCookieService.cpp in Firefox 3.0.4, Firefox 3.0.4
380
- # and IE does not check, too.
381
- end
382
196
 
383
- path ||= url.path.sub(%r|/[^/]*\z|, '')
384
- domain ||= domainname
385
- @cookies.synchronize do
386
- cookie = find_cookie_info(domain, path, name)
387
- if !cookie
388
- cookie = WebAgent::Cookie.new()
389
- cookie.use = true
390
- @cookies << cookie
391
- end
392
- check_expired_cookies()
393
- end
197
+ alias original_domain domain
394
198
 
395
- cookie.url = url
396
- cookie.name = name
397
- cookie.value = value
398
- cookie.expires = expires
399
- cookie.domain = domain
400
- cookie.path = path
401
-
402
- ## for flag
403
- cookie.secure = secure
404
- cookie.http_only = http_only
405
- cookie.domain_orig = domain_orig
406
- cookie.path_orig = path_orig
407
- if discard || cookie.expires == nil
408
- cookie.discard = true
409
- else
410
- cookie.discard = false
411
- @is_saved = false
412
- end
199
+ def domain
200
+ warning('Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.')
201
+ self.original_domain
413
202
  end
414
203
 
415
- def load_cookies()
416
- return if !File.readable?(@cookies_file)
417
- @cookies.synchronize do
418
- @cookies.clear
419
- File.open(@cookies_file,'r'){|f|
420
- while line = f.gets
421
- cookie = WebAgent::Cookie.new()
422
- @cookies << cookie
423
- col = line.chomp.split(/\t/)
424
- cookie.url = HTTPClient::Util.urify(col[0])
425
- cookie.name = col[1]
426
- cookie.value = col[2]
427
- if col[3].empty? or col[3] == '0'
428
- cookie.expires = nil
429
- else
430
- cookie.expires = Time.at(col[3].to_i).gmtime
431
- end
432
- cookie.domain = col[4]
433
- cookie.path = col[5]
434
- cookie.set_flag(col[6])
435
- end
436
- }
437
- end
204
+ def flag
205
+ deprecated('flag', 'secure, for_domain, etc.')
206
+ HTTPClient::WebAgentSaver.flag(self)
438
207
  end
439
208
 
440
- def check_cookie_accept_domain(domain)
441
- unless domain
442
- return false
443
- end
444
- @accept_domains.each{|dom|
445
- if domain_match(domain, dom)
446
- return true
447
- end
448
- }
449
- @reject_domains.each{|dom|
450
- if domain_match(domain, dom)
451
- return false
452
- end
453
- }
454
- return true
209
+ private
210
+
211
+ def deprecated(old, new)
212
+ warning("WebAgent::Cookie is deprecated and will be replaced with HTTP::Cookie in the near future. Please use Cookie##{new} instead of Cookie##{old} for the replacement.")
455
213
  end
456
214
  end
457
215
  end
458
216
 
459
- __END__
460
-
461
- =begin
462
-
463
- == WebAgent::CookieManager Class
464
-
465
- Load, save, parse and send cookies.
466
-
467
- === Usage
468
-
469
- ## initialize
470
- cm = WebAgent::CookieManager.new("/home/foo/bar/cookie")
471
-
472
- ## load cookie data
473
- cm.load_cookies()
474
-
475
- ## parse cookie from string (maybe "Set-Cookie:" header)
476
- cm.parse(str)
477
-
478
- ## send cookie data to url
479
- f.write(cm.find(url))
480
-
481
- ## save cookie to cookiefile
482
- cm.save_cookies()
483
-
484
-
485
- === Class Methods
486
-
487
- -- CookieManager::new(file=nil)
488
-
489
- create new CookieManager. If a file is provided,
490
- use it as cookies' file.
491
-
492
- === Methods
493
-
494
- -- CookieManager#save_cookies(force = nil)
495
-
496
- save cookies' data into file. if argument is true,
497
- save data although data is not modified.
498
-
499
- -- CookieManager#parse(str, url)
500
-
501
- parse string and store cookie (to parse HTTP response header).
502
-
503
- -- CookieManager#find(url)
504
-
505
- get cookies and make into string (to send as HTTP request header).
506
-
507
- -- CookieManager#add(cookie)
508
-
509
- add new cookie.
510
-
511
- -- CookieManager#load_cookies()
512
-
513
- load cookies' data from file.
514
-
515
-
516
- == WebAgent::CookieUtils Module
517
-
518
- -- CookieUtils::head_match?(str1, str2)
519
- -- CookieUtils::tail_match?(str1, str2)
520
- -- CookieUtils::domain_match(host, domain)
521
- -- CookieUtils::total_dot_num(str)
522
-
523
-
524
- == WebAgent::Cookie Class
525
-
526
- === Class Methods
527
-
528
- -- Cookie::new()
529
-
530
- create new cookie.
531
-
532
- === Methods
533
-
534
- -- Cookie#match?(url)
535
-
536
- match cookie by url. if match, return true. otherwise,
537
- return false.
538
-
539
- -- Cookie#name
540
- -- Cookie#name=(name)
541
- -- Cookie#value
542
- -- Cookie#value=(value)
543
- -- Cookie#domain
544
- -- Cookie#domain=(domain)
545
- -- Cookie#path
546
- -- Cookie#path=(path)
547
- -- Cookie#expires
548
- -- Cookie#expires=(expires)
549
- -- Cookie#url
550
- -- Cookie#url=(url)
551
-
552
- accessor methods for cookie's items.
553
-
554
- -- Cookie#discard?
555
- -- Cookie#discard=(discard)
556
- -- Cookie#use?
557
- -- Cookie#use=(use)
558
- -- Cookie#secure?
559
- -- Cookie#secure=(secure)
560
- -- Cookie#http_only?
561
- -- Cookie#http_only=(http_only)
562
- -- Cookie#domain_orig?
563
- -- Cookie#domain_orig=(domain_orig)
564
- -- Cookie#path_orig?
565
- -- Cookie#path_orig=(path_orig)
566
- -- Cookie#override?
567
- -- Cookie#override=(override)
568
- -- Cookie#flag
569
- -- Cookie#set_flag(flag_num)
570
-
571
- accessor methods for flags.
572
-
573
- =end
217
+ rescue LoadError
218
+ require 'httpclient/webagent-cookie'
219
+ end
220
+ end