ovfparse 0.7.26 → 0.8.5

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.
@@ -18,9 +18,24 @@ class HttpVmRepository < VmRepository
18
18
 
19
19
 
20
20
  def get
21
- #TODO slap a '/' char on the end of self.uri if it doesn't have one, otherwise many servers return 403
22
- url = URI.parse(URI.escape(self.uri))
23
- req = Net::HTTP::Get.new(url.path)
21
+ begin
22
+ url = URI.parse(URI.escape(self.uri))
23
+ req = Net::HTTP::Get.new(url.path)
24
+ rescue
25
+ if(uri.match(/\/$/) == nil)
26
+ begin
27
+ url = URI.parse(URI.escape(self.uri + '/'))
28
+ req = Net::HTTP::Get.new(url.path)
29
+ @url = @url + '/'
30
+ rescue Exception => e
31
+ raise "We tried it with and without a trailing / but it still doesn't work, this thing is broken: " + e.message
32
+ # TODO: log the fact that this repo sucks at life
33
+ end
34
+ else
35
+ raise "This has a trailing slash and it doesn't work so it's a busted URL"
36
+ end
37
+ end
38
+
24
39
  res = Net::HTTP.start(url.host, url.port) {|http|
25
40
  http.request(req)
26
41
  }
@@ -25,7 +25,22 @@ class MarketplaceRepository < VmRepository
25
25
 
26
26
  def fetch
27
27
  #retrieve data from http server
28
- raw_html = open(uri)
28
+ begin
29
+ raw_html = open(uri)
30
+ rescue
31
+ if(uri.match(/\/$/) != nil)
32
+ begin
33
+ raw_html = open(uri[0..-2])
34
+ @url = @url[0..-2]
35
+ rescue Exception => e
36
+ #something useful
37
+ raise "Tried getting rid of the trailing slash but still no dice: " + e.message
38
+ end
39
+ else
40
+ #something useful
41
+ raise "No trailing slash so this is probably a dead URL"
42
+ end
43
+ end
29
44
  if (raw_html)
30
45
 
31
46
  #parse out package list from index html
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovfparse
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 7
9
- - 26
10
- version: 0.7.26
8
+ - 8
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Barkley
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-26 00:00:00 -04:00
18
+ date: 2011-08-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency