jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/2] jena git commit: JENA-1632: https support in SOH scripts
Date Fri, 23 Nov 2018 14:59:38 GMT
Repository: jena
Updated Branches:
  refs/heads/master 204060b98 -> ba4d28f49


JENA-1632: https support in SOH scripts


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/3044c61f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/3044c61f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/3044c61f

Branch: refs/heads/master
Commit: 3044c61f5188505e78b67d6c6071d65ac4056424
Parents: df9b41d
Author: Andy Seaborne <andy@apache.org>
Authored: Thu Nov 22 11:42:56 2018 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Thu Nov 22 11:42:56 2018 +0000

----------------------------------------------------------------------
 jena-fuseki2/apache-jena-fuseki/bin/s-delete    | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-get       | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-head      | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-post      | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-put       | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-query     | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/s-update    | 99 ++++++++++----------
 .../apache-jena-fuseki/bin/s-update-form        | 99 ++++++++++----------
 jena-fuseki2/apache-jena-fuseki/bin/soh         | 99 ++++++++++----------
 9 files changed, 450 insertions(+), 441 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-delete
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-delete b/jena-fuseki2/apache-jena-fuseki/bin/s-delete
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-delete
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-delete
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-get
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-get b/jena-fuseki2/apache-jena-fuseki/bin/s-get
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-get
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-get
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-head
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-head b/jena-fuseki2/apache-jena-fuseki/bin/s-head
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-head
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-head
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-post
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-post b/jena-fuseki2/apache-jena-fuseki/bin/s-post
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-post
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-post
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-put
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-put b/jena-fuseki2/apache-jena-fuseki/bin/s-put
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-put
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-put
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-query
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-query b/jena-fuseki2/apache-jena-fuseki/bin/s-query
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-query
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-query
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-update
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-update b/jena-fuseki2/apache-jena-fuseki/bin/s-update
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-update
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-update
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/s-update-form
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/s-update-form b/jena-fuseki2/apache-jena-fuseki/bin/s-update-form
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/s-update-form
+++ b/jena-fuseki2/apache-jena-fuseki/bin/s-update-form
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 

http://git-wip-us.apache.org/repos/asf/jena/blob/3044c61f/jena-fuseki2/apache-jena-fuseki/bin/soh
----------------------------------------------------------------------
diff --git a/jena-fuseki2/apache-jena-fuseki/bin/soh b/jena-fuseki2/apache-jena-fuseki/bin/soh
index 9bb7198..2b14618 100755
--- a/jena-fuseki2/apache-jena-fuseki/bin/soh
+++ b/jena-fuseki2/apache-jena-fuseki/bin/soh
@@ -21,6 +21,7 @@
 
 require 'optparse'
 require 'net/http'
+require 'openssl'
 require 'uri'
 require 'cgi'
 require 'pp'
@@ -42,7 +43,7 @@ $proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 # What about direct naming?
 
 # Names
-$mtTurtle           = 'text/turtle'
+$mtTurtle           = 'text/turtle;charset=utf-8'
 $mtRDF              = 'application/rdf+xml'
 $mtText             = 'text/plain'
 $mtNTriples         = 'application/n-triples'
@@ -62,7 +63,7 @@ $mtSparqlQuery      = "application/sparql-query" ;
 # Global media type table.
 $fileMediaTypes = {}
 $fileMediaTypes['ttl']   = $mtTurtle
-$fileMediaTypes['n3']    = 'text/n3'
+$fileMediaTypes['n3']    = 'text/n3; charset=utf-8'
 $fileMediaTypes['nt']    = $mtText
 $fileMediaTypes['rdf']   = $mtRDF
 $fileMediaTypes['owl']   = $mtRDF
@@ -75,7 +76,6 @@ $fileMediaTypes['jsonld']  = $mtJSONLD
 $charsetUTF8      = 'utf-8'
 $charset = {}
 $charset[$mtTurtle]   = 'utf-8'
-$charset['text/n3']   = 'utf-8'
 $charset[$mtText]     = 'ascii'
 $charset[$mtTriG]     = 'utf-8'
 $charset[$mtNQuads]   = 'utf-8'
@@ -215,64 +215,65 @@ end
 def response_no_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
   http.read_timeout = nil
-  # check we can connect.
-  begin http.start
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+  end
+  
+  begin http.start do |http|
+      response = http.request(request)
+      print_http_response(response)
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code} #{response.message} #{uri}", 9
+        # Unreachable
+        response.error!
+      end
+    end
   rescue Exception => e  
     # puts e.message  
     #puts e.backtrace.inspect  
     warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
-  response = http.request(request)
-  print_http_response(response)
-  case response
-  when Net::HTTPSuccess, Net::HTTPRedirection
-    # OK
-  when Net::HTTPNotFound
-    warn_exit "404 Not found: #{uri}", 9
-    #print response.body
-  else
-    warn_exit "#{response.code} #{response.message} #{uri}", 9
-    # Unreachable
-      response.error!
-  end
-  # NO BODY IN RESPONSE
 end
 
 def response_print_body(uri, request)
   http = Net::HTTP::Proxy($proxy.host,$proxy.port).new(uri.host, uri.port)
-  http.read_timeout = nil
-  # check we can connect.
-  begin http.start
-  rescue => e  
-    #puts e.backtrace.inspect  
-    #print e.class
-    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
+  if uri.scheme == 'https'
+    http.use_ssl = uri.scheme == 'https'
+    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
   end
-
-  # Add a blank line if headers were output.
-  print "\n" if $http_print ;
-
-  begin
-    response = http.request(request) { |res| 
-      print_http_response(res)
-      #puts res.code
-      res.read_body do |segment|
-        print segment
+  begin http.start do |http|
+      
+      # Add a blank line if headers were output.
+      print "\n" if $http_print ;
+
+      response = http.request(request) { |res| 
+        print_http_response(res)
+        #puts res.code
+        res.read_body do |segment|
+          print segment
+        end
+      }
+      case response
+      when Net::HTTPSuccess, Net::HTTPRedirection
+        # OK
+      when Net::HTTPNotFound
+        warn_exit "404 Not found: #{uri}", 9
+        #print response.body
+      else
+        warn_exit "#{response.code}: #{uri}", 9
+        # Unreachable
+        response.error!
       end
-    }
-    case response
-    when Net::HTTPSuccess, Net::HTTPRedirection
-      # OK
-    when Net::HTTPNotFound
-      warn_exit "404 Not found: #{uri}", 9
-      #print response.body
-    else
-      warn_exit "#{response.code}: #{uri}", 9
-      # Unreachable
-      response.error!
     end
-  rescue EOFError => e
-    warn_exit "IO Error: "+e.message, 3
+  rescue Exception => e
+    warn_exit "Failed to connect: #{uri.host}:#{uri.port}: #{e.message}", 3
   end
 end
 


Mime
View raw message