Clojure aleph`http-server`不响应正文

时间:2018-10-26 08:40:58

标签: linux http clojure

我启动了Clojure aleph http服务器,使用以下代码:

(ns app.websvc
  (:require
   [aleph.http :as http]
   [compojure.core :as compojure :refer [GET POST]]
   [ring.middleware.params :as params]))

(defn root-handler
  [req]
  {:status 200
   :headers {"content-type" "text/plain"}
   :body "wallet backend"})

(def http-handler
  (params/wrap-params
   (compojure/routes
    (GET "/" [] root-handler))))

(http/start-server http-handler {:port 8080})

我对此进行了测试:

$ curl -v "http://localhost:8080/"
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>

似乎已连接,但无任何反应。可能是什么问题?

我在本地计算机上运行了相同的代码,curl命令正确响应,但在新购买的远程云主机上无法正常工作(上述问题)。

已更新

我这样做了:

$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

也挂起。

0 个答案:

没有答案