Search code examples
clojurehttp-kit

HTTPKit gives ProtocolException: "No status" for a Let's Encrypt site


I'm trying to retrieve a URL. At the time of writing: https://upvote.pub/

Using the java.net.URL, I can retrieve this fine:

=> (count (slurp (.openStream (java.net.URL. "https://upvote.pub/"))))
44353

Ditto clj-http:

=> (count (:body (clj-http.client/get "https://upvote.pub/")))
44353

But when I use HTTPKit I run into problems:

=> @(http/get "https://upvote.pub/")
{:opts {:method :get, :url "https://upvote.pub/"}, :error #error {
 :cause "No status"
 :via
 [{:type org.httpkit.ProtocolException
   :message "No status"
   :at [org.httpkit.client.RespListener onCompleted "RespListener.java" 126]}]
 :trace
 [[org.httpkit.client.RespListener onCompleted "RespListener.java" 126]
  [org.httpkit.client.Request finish "Request.java" 51]
  [org.httpkit.client.HttpClient doRead "HttpClient.java" 156]
  [org.httpkit.client.HttpClient run "HttpClient.java" 426]
  [java.lang.Thread run "Thread.java" 745]]}}

This site uses Let's Encrypt. However, other Let's Encrypt sites seem to work:

=> (-> "https://letsencrypt.org/" http/get deref :body count)
21490

The certificate has different properties, but it's from the same authority.

Furthermore, if I include :insecure? true, the error still happens.

I thought this might be related to this HTTPS + proxy bug, as the symptoms are similar and Google App Engine seems to be load-balancing the site. However, this fix was rolled into release 2.2.0.

Is this a bug with HTTP-Kit? Can I work round it?

  • openjdk version "1.8.0_92-internal"
  • Clojure version 1.8.0
  • http-kit version "2.2.0"

Solution

  • It looks like this was caused by SNI (Server Name Identification). I used HTTP Kit version “2.3.0-alpha5” and followed this blog post. It now works.