web_translate_it 1.7.0.7.pre → 1.7.0.7.pre2

Sign up to get free protection for your applications and to get access to all the features.
data/history.md CHANGED
@@ -1,6 +1,7 @@
1
- ## Version 1.7.0.7.pre / 2010-10-12
1
+ ## Version 1.7.0.7.pre (pre-release)
2
2
 
3
- * Fix so wti can connect through a proxy.
3
+ * Fix connection problems through a proxy (1.7.0.7.pre)
4
+ * Fix eventual problems connecting through an authenticated proxy (1.7.0.7.pre2)
4
5
 
5
6
  ## Version 1.7.0.6 / 2010-09-23
6
7
 
@@ -3,6 +3,7 @@ module WebTranslateIt
3
3
  require 'net/http'
4
4
  require 'net/https'
5
5
  require 'uri'
6
+ require 'ostruct'
6
7
 
7
8
  # A few useful functions
8
9
  class Util
@@ -26,23 +27,14 @@ module WebTranslateIt
26
27
  # This method will try to connect through a proxy if `http_proxy` is set.
27
28
  #
28
29
  def self.http_connection
29
- proxy = Util.get_proxy
30
- if proxy
31
- http = Net::HTTP::Proxy(proxy.host, proxy.port).new('webtranslateit.com', 443)
32
- else
33
- http = Net::HTTP.new('webtranslateit.com', 443)
34
- end
30
+ proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
31
+ http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password).new('webtranslateit.com', 443)
35
32
  http.use_ssl = true
36
33
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
37
34
  http.open_timeout = http.read_timeout = 20
38
35
  yield http
39
36
  end
40
-
41
- def self.get_proxy
42
- http_proxy = ENV["http_proxy"]
43
- URI.parse(http_proxy) rescue nil
44
- end
45
-
37
+
46
38
  def self.calculate_percentage(processed, total)
47
39
  return 0 if total == 0
48
40
  ((processed*10)/total).to_f.ceil*10
data/version.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 1
3
3
  :minor: 7
4
4
  :tiny: 0
5
- :patch: 7.pre
5
+ :patch: 7.pre2
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961916152
4
+ hash: -1876988323
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 7
9
9
  - 0
10
10
  - 7
11
- - pre
12
- version: 1.7.0.7.pre
11
+ - pre2
12
+ version: 1.7.0.7.pre2
13
13
  platform: ruby
14
14
  authors:
15
15
  - "\xC3\x89douard Bri\xC3\xA8re"
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-12 00:00:00 +02:00
20
+ date: 2010-10-15 00:00:00 +02:00
21
21
  default_executable: wti
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency