[Groonga-commit] ranguba/chupa-text at 373e3b7 [master] http-server: add support for connection timeout by "Expect: 100-continue"

Back to archive index
Sutou Kouhei null+****@clear*****
Fri Jun 7 06:36:17 JST 2019


Sutou Kouhei	2019-06-07 06:36:17 +0900 (Fri, 07 Jun 2019)

  Revision: 373e3b73d410a39656e25bca5925197c3ea290cd
  https://github.com/ranguba/chupa-text/commit/373e3b73d410a39656e25bca5925197c3ea290cd

  Message:
    http-server: add support for connection timeout by "Expect: 100-continue"

  Modified files:
    lib/chupa-text/decomposers/http-server.rb

  Modified: lib/chupa-text/decomposers/http-server.rb (+6 -5)
===================================================================
--- lib/chupa-text/decomposers/http-server.rb    2019-05-20 11:33:40 +0900 (da829f6)
+++ lib/chupa-text/decomposers/http-server.rb    2019-06-07 06:36:17 +0900 (ef9ad3d)
@@ -60,11 +60,11 @@ module ChupaText
         http = Net::HTTP.new(url.host, url.port)
         http.use_ssl = true if url.is_a?(URI::HTTPS)
         if data.timeout.is_a?(Numeric)
-          http.open_timeout = data.timeout * 1.5
-          http.read_timeout = data.timeout * 1.5
-          if http.respond_to?(:write_timeout=)
-            http.write_timeout = data.timeout * 1.5
-          end
+          timeout = data.timeout * 1.5
+          http.open_timeout = timeout
+          http.read_timeout = timeout
+          http.write_timeout = timeout if http.respond_to?(:write_timeout=)
+          http.continue_timeout = timeout
         end
         begin
           http.start do
@@ -101,6 +101,7 @@ module ChupaText
       def process_request(url, http, data)
         request = Net::HTTP::Post.new(url)
         request["transfer-encoding"] = "chunked"
+        request["expect"] = "100-continue" if http.continue_timeout
         data.open do |input|
           request.set_form(build_parameters(data, input),
                            "multipart/form-data")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190607/931fe653/attachment.html>


More information about the Groonga-commit mailing list
Back to archive index