chupa-text 1.2.5 → 1.2.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6eed021988da255a580fd8749e9f023f5a661c7950baff1403918ea153d48073
4
- data.tar.gz: 0aa05754add5afd4b2527ed7b2bc90f8061b558ee0910d74b32f19658c3d3f2e
3
+ metadata.gz: 0555d47f2e5bc1f80ed47485190a9db10a7a3996a4f8e43012dff65cc19e4069
4
+ data.tar.gz: acc1ea064a381f34ded5e9253b93ddefd33308d5b12184f3f2bb018dc98f985a
5
5
  SHA512:
6
- metadata.gz: 826667ab8c067a9a09c2b1801bc90a76869e43c345d262efd29a564da80a37c67f6ae607645c91487fe264fae4f872dec7f7ac7324ba0ed755f0a7759686e992
7
- data.tar.gz: 2696c77f826dc04c27da73b97a640f723afd2007e2310ce35a2d67d27a28c924afeb3dbc3ceb298f7e9befafe2619c782ad300ce9fb086a49466b664d27b9d80
6
+ metadata.gz: 9c3ea10422cd7cf588f07ee97819499c6c33fcbb9bf235b2d49ac3fe69aa29feaae42e94a9fddde48532293f503d8d4f4bb1d75a897d7045e1910d8cea261cac
7
+ data.tar.gz: e8d8e3e1acfcc6a9a1b4329118652590d3a354cbce043aad821960dcd169a049e9917ae9e4bf13ab3c14e7da2df613cb16f627d138d4c372cc2fbf301ddb1f4d
@@ -1,5 +1,13 @@
1
1
  # News
2
2
 
3
+ ## 1.2.6: 2019-06-10
4
+
5
+ ### Improvements
6
+
7
+ * `http-server`: Added support for `Expect: 100-continue`.
8
+
9
+ * Removed temporary files immediately.
10
+
3
11
  ## 1.2.5: 2019-05-20
4
12
 
5
13
  ### Improvements
@@ -162,6 +162,9 @@ module ChupaText
162
162
  yield(StringIO.new(body))
163
163
  end
164
164
 
165
+ def release
166
+ end
167
+
165
168
  def peek_body(size)
166
169
  _body = body
167
170
  return nil if _body.nil?
@@ -60,11 +60,11 @@ module ChupaText
60
60
  http = Net::HTTP.new(url.host, url.port)
61
61
  http.use_ssl = true if url.is_a?(URI::HTTPS)
62
62
  if data.timeout.is_a?(Numeric)
63
- http.open_timeout = data.timeout * 1.5
64
- http.read_timeout = data.timeout * 1.5
65
- if http.respond_to?(:write_timeout=)
66
- http.write_timeout = data.timeout * 1.5
67
- end
63
+ timeout = data.timeout * 1.5
64
+ http.open_timeout = timeout
65
+ http.read_timeout = timeout
66
+ http.write_timeout = timeout if http.respond_to?(:write_timeout=)
67
+ http.continue_timeout = timeout
68
68
  end
69
69
  begin
70
70
  http.start do
@@ -101,6 +101,7 @@ module ChupaText
101
101
  def process_request(url, http, data)
102
102
  request = Net::HTTP::Post.new(url)
103
103
  request["transfer-encoding"] = "chunked"
104
+ request["expect"] = "100-continue" if http.continue_timeout
104
105
  data.open do |input|
105
106
  request.set_form(build_parameters(data, input),
106
107
  "multipart/form-data")
@@ -90,11 +90,15 @@ module ChupaText
90
90
  if decomposer.nil?
91
91
  if target.text_plain?
92
92
  debug {"#{log_tag}[extract][text-plain]"}
93
- yield(target.to_utf8_body_data)
93
+ utf8_data = target.to_utf8_body_data
94
+ yield(utf8_data)
95
+ utf8_data.release unless target == utf8_data
94
96
  else
95
97
  debug {"#{log_tag}[extract][decomposer] not found"}
96
98
  if target.text?
97
- yield(target.to_utf8_body_data)
99
+ utf8_data = target.to_utf8_body_data
100
+ yield(utf8_data)
101
+ utf8_data.release unless target == utf8_data
98
102
  end
99
103
  end
100
104
  else
@@ -107,6 +111,7 @@ module ChupaText
107
111
  "<#{target.mime_type}> -> <#{decomposed.mime_type}>"
108
112
  end
109
113
  extract_recursive(decomposed, &block)
114
+ decomposed.release
110
115
  end
111
116
  end
112
117
  end
@@ -28,6 +28,9 @@ module ChupaText
28
28
  File.open(@path, "rb", &block)
29
29
  end
30
30
 
31
+ def release
32
+ end
33
+
31
34
  def body
32
35
  open do |file|
33
36
  file.read
@@ -48,6 +48,10 @@ module ChupaText
48
48
  @content.open(&block)
49
49
  end
50
50
 
51
+ def release
52
+ @content.release
53
+ end
54
+
51
55
  private
52
56
  def download
53
57
  begin
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module ChupaText
18
- VERSION = "1.2.5"
18
+ VERSION = "1.2.6"
19
19
  end
@@ -56,6 +56,14 @@ module ChupaText
56
56
  end
57
57
  end
58
58
 
59
+ def release
60
+ @body = nil
61
+ if @file
62
+ @file.delete
63
+ @file = nil
64
+ end
65
+ end
66
+
59
67
  def body
60
68
  if @body
61
69
  @body
@@ -38,5 +38,9 @@ module ChupaText
38
38
  def open(&block)
39
39
  @content.open(&block)
40
40
  end
41
+
42
+ def release
43
+ @content.release
44
+ end
41
45
  end
42
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-20 00:00:00.000000000 Z
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: archive-zip