OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A

This is a problem at the server site. It looks like the server is exclusively accepting TLS 1.2 and does not show the usual behavior when the client requests something lesser (like downgrading or sending SSL alert) but instead just closes the connection. TLS 1.2 is not supported by OpenSSL 0.9.8 and additionally your code … Read more

Ruby – net/http – following redirects

To follow redirects, you can do something like this (taken from ruby-doc) Following Redirection require ‘net/http’ require ‘uri’ def fetch(uri_str, limit = 10) # You should choose better exception. raise ArgumentError, ‘HTTP redirect too deep’ if limit == 0 url = URI.parse(uri_str) req = Net::HTTP::Get.new(url.path, { ‘User-Agent’ => ‘Mozilla/5.0 (etc…)’ }) response = Net::HTTP.start(url.host, url.port, … Read more

Process Management for the Go Webserver

Tweaking / configuring the HTTP server The type that implements the HTTP server is http.Server. If you don’t create an http.Server yourself e.g. because you call the http.ListenAndServe() function, that creates an http.Server under the hood for you: func ListenAndServe(addr string, handler Handler) error { server := &Server{Addr: addr, Handler: handler} return server.ListenAndServe() } So … Read more