mechanize 0.6.10 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mechanize might be problematic. Click here for more details.

@@ -1,5 +1,16 @@
1
1
  = Mechanize CHANGELOG
2
2
 
3
+ == 0.6.11
4
+
5
+ * Detecting single quotes in meta redirects.
6
+ * Adding pretty inspect for ruby versions > 1.8.4 (Thanks Joel Kociolek)
7
+ http://rubyforge.org/tracker/index.php?func=detail&aid=13150&group_id=1453&atid=5709
8
+ * Fixed bug with file name in multipart posts
9
+ http://rubyforge.org/tracker/?func=detail&aid=15594&group_id=1453&atid=5709
10
+ * Posting forms relative to the originating page. Thanks Mortee.
11
+ * Added a FAQ
12
+ http://rubyforge.org/tracker/?func=detail&aid=15772&group_id=1453&atid=5709
13
+
3
14
  == 0.6.10
4
15
 
5
16
  * Made digest authentication work with POSTs.
data/FAQ.txt ADDED
@@ -0,0 +1,11 @@
1
+ Q: I keep getting an EOFError:
2
+ protocol.rb:133:in `sysread': end of file reached (EOFError)
3
+
4
+ A: Some people have experienced an EOFError during normal mechanize usage.
5
+ Most of the time this occurs because the remote website claims to support
6
+ keep alives, but does not implement them correctly. Try turning off
7
+ keep alives on your mechanize object:
8
+
9
+ mech.keep_alive = false
10
+
11
+
@@ -1,5 +1,6 @@
1
1
  CHANGELOG.txt
2
2
  EXAMPLES.txt
3
+ FAQ.txt
3
4
  GUIDE.txt
4
5
  LICENSE.txt
5
6
  Manifest.txt
@@ -64,7 +64,7 @@ class Mechanize
64
64
  ##
65
65
  # The version of Mechanize you are using.
66
66
 
67
- VERSION = '0.6.10'
67
+ VERSION = '0.6.11'
68
68
 
69
69
  ##
70
70
  # User Agent aliases
@@ -241,7 +241,7 @@ class Mechanize
241
241
  # agent.submit(page.forms.first, page.forms.first.buttons.first)
242
242
  def submit(form, button=nil)
243
243
  form.add_button_to_query(button) if button
244
- uri = to_absolute_uri(form.action)
244
+ uri = to_absolute_uri(form.action, form.page)
245
245
  case form.method.upcase
246
246
  when 'POST'
247
247
  post_form(uri, form)
@@ -176,9 +176,10 @@ module WWW
176
176
  end
177
177
 
178
178
  def file_to_multipart(file)
179
+ file_name = file.file_name ? ::File.basename(file.file_name) : ''
179
180
  body = "Content-Disposition: form-data; name=\"" +
180
181
  "#{mime_value_quote(file.name)}\"; " +
181
- "filename=\"#{mime_value_quote(file.file_name || '')}\"\r\n" +
182
+ "filename=\"#{mime_value_quote(file_name)}\"\r\n" +
182
183
  "Content-Transfer-Encoding: binary\r\n"
183
184
 
184
185
  if file.file_data.nil? and ! file.file_name.nil?
@@ -40,7 +40,7 @@ module WWW
40
40
  }
41
41
  }
42
42
  end
43
- if RUBY_VERSION > '1.8.2'
43
+ if RUBY_VERSION > '1.8.4'
44
44
  alias :inspect :pretty_inspect
45
45
  end
46
46
  end
@@ -52,7 +52,7 @@ module WWW
52
52
  q.breakable; q.pp href
53
53
  }
54
54
  end
55
- if RUBY_VERSION > '1.8.2'
55
+ if RUBY_VERSION > '1.8.4'
56
56
  alias :inspect :pretty_inspect
57
57
  end
58
58
  end
@@ -106,7 +106,7 @@ module WWW
106
106
  equiv = node['http-equiv']
107
107
  content = node['content']
108
108
  if equiv != nil && equiv.downcase == 'refresh'
109
- if content != nil && content =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i
109
+ if content != nil && content =~ /^\d+\s*;\s*url\s*=\s*'?([^\s']+)/i
110
110
  node['href'] = $1
111
111
  @meta << Meta.new(node, @mech, self)
112
112
  end
@@ -3,6 +3,7 @@
3
3
  <meta http_equiv="Refresh" content="0; url=http://www.incorrect.com">
4
4
  <meta http-equiv="Rfresh" content="0; url=http://www.also-wrong.com">
5
5
  <meta http-equiv="Refresh" content="0; url=http://www.drphil.com/">
6
+ <meta http-equiv="Refresh" content="0; url='http://tenderlovemaking.com/'">
6
7
  <META HTTP-EQUIV="REFRESH" CONTENT="0; URL=HTTP://WWW.UPCASE.COM/">
7
8
  <TITLE>Testing the links</TITLE>
8
9
  </head>
@@ -20,9 +20,12 @@ class LinksMechTest < Test::Unit::TestCase
20
20
 
21
21
  def test_find_meta
22
22
  page = @agent.get("http://localhost:#{PORT}/find_link.html")
23
- assert_equal(2, page.meta.length)
24
- assert_equal("http://www.drphil.com/", page.meta[0].href.downcase)
25
- assert_equal("http://www.upcase.com/", page.meta[1].href.downcase)
23
+ assert_equal(3, page.meta.length)
24
+ assert_equal(%w{
25
+ http://www.drphil.com/
26
+ http://www.upcase.com/
27
+ http://tenderlovemaking.com/ }.sort,
28
+ page.meta.map { |x| x.href.downcase }.sort)
26
29
  end
27
30
 
28
31
  def test_find_link
@@ -24,7 +24,7 @@ class UploadMechTest < Test::Unit::TestCase
24
24
  @page = @agent.submit(form)
25
25
 
26
26
  assert_match(
27
- "Content-Disposition: form-data; name=\"userfile1\"; filename=\"#{BASE_DIR}/test_all.rb\"",
27
+ "Content-Disposition: form-data; name=\"userfile1\"; filename=\"test_all.rb\"",
28
28
  @page.body
29
29
  )
30
30
  assert_match(
@@ -47,7 +47,7 @@ class UploadMechTest < Test::Unit::TestCase
47
47
  @page = @agent.submit(form)
48
48
 
49
49
  assert_match(
50
- "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"#{BASE_DIR}/test_all.rb\"",
50
+ "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"test_all.rb\"",
51
51
  @page.body
52
52
  )
53
53
  end
@@ -62,7 +62,7 @@ class UploadMechTest < Test::Unit::TestCase
62
62
 
63
63
  contents = File.open("#{BASE_DIR}/test_all.rb", 'rb') { |f| f.read }
64
64
  assert_match(
65
- "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"#{BASE_DIR}/test_all.rb\"",
65
+ "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"test_all.rb\"",
66
66
  @page.body
67
67
  )
68
68
  assert_match(contents, @page.body)
@@ -79,7 +79,7 @@ class UploadMechTest < Test::Unit::TestCase
79
79
 
80
80
  contents = File.open("#{BASE_DIR}/test_all.rb", 'rb') { |f| f.read }
81
81
  assert_match(
82
- "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"#{BASE_DIR}/test_all.rb\"",
82
+ "Content-Disposition: form-data; name=\"green[eggs]\"; filename=\"test_all.rb\"",
83
83
  @page.body
84
84
  )
85
85
  assert_match(contents, @page.body)
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: mechanize
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.10
7
- date: 2007-07-26 00:00:00 -07:00
6
+ version: 0.6.11
7
+ date: 2007-12-04 00:00:00 -08:00
8
8
  summary: Mechanize provides automated web-browsing
9
9
  require_paths:
10
10
  - lib
@@ -31,6 +31,7 @@ authors:
31
31
  files:
32
32
  - CHANGELOG.txt
33
33
  - EXAMPLES.txt
34
+ - FAQ.txt
34
35
  - GUIDE.txt
35
36
  - LICENSE.txt
36
37
  - Manifest.txt
@@ -161,6 +162,7 @@ rdoc_options:
161
162
  extra_rdoc_files:
162
163
  - CHANGELOG.txt
163
164
  - EXAMPLES.txt
165
+ - FAQ.txt
164
166
  - GUIDE.txt
165
167
  - LICENSE.txt
166
168
  - Manifest.txt
@@ -189,5 +191,5 @@ dependencies:
189
191
  requirements:
190
192
  - - ">="
191
193
  - !ruby/object:Gem::Version
192
- version: 1.2.2
194
+ version: 1.3.0
193
195
  version: