diff --git a/README.md b/README.md index c78be9e..2978a20 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,6 @@ worth noting. This was done as a proof of concept, but the code is simple enough that I am confident it is as production ready as microhttp. -That being said, I'm gonna put breaking changes in willy-nilly until it is -published to maven central. - ## deps.edn ```clojure diff --git a/deps.edn b/deps.edn index c2e0fe4..e23d19c 100644 --- a/deps.edn +++ b/deps.edn @@ -1,3 +1,3 @@ {:paths ["src"] :deps {ring/ring-core {:mvn/version "1.9.5"} - org.microhttp/microhttp {:mvn/version "0.7"}}} \ No newline at end of file + org.microhttp/microhttp {:mvn/version "0.10"}}} \ No newline at end of file diff --git a/src/dev/mccue/microhttp_ring_adapter.clj b/src/dev/mccue/microhttp_ring_adapter.clj index 49c76f8..9864a3d 100644 --- a/src/dev/mccue/microhttp_ring_adapter.clj +++ b/src/dev/mccue/microhttp_ring_adapter.clj @@ -1,7 +1,7 @@ (ns dev.mccue.microhttp-ring-adapter (:require [clojure.string :as string] [ring.core.protocols :as ring-protocols]) - (:import (org.microhttp Request Handler Response Header EventLoop Options DebugLogger Logger) + (:import (org.microhttp NoopLogger OptionsBuilder Request Handler Response Header EventLoop Options DebugLogger Logger) (java.io ByteArrayInputStream ByteArrayOutputStream) (java.util.concurrent ForkJoinPool ExecutorService))) @@ -104,39 +104,37 @@ ([handler] (create-event-loop handler {})) ([handler options] - (let [microhttp-options (cond-> (Options.) - (contains? options :host) - (.withHost (:host options)) + (let [microhttp-options-builder (cond-> (OptionsBuilder/newBuilder) + (contains? options :host) + (.withHost (:host options)) - (some? (options :port)) - (.withPort (:port options)) + (some? (options :port)) + (.withPort (:port options)) - (some? (options :reuse-addr)) - (.withReuseAddr (:reuse-addr options)) + (some? (options :reuse-addr)) + (.withReuseAddr (:reuse-addr options)) - (some? (options :reuse-port)) - (.withReusePort (:reuse-port options)) + (some? (options :reuse-port)) + (.withReusePort (:reuse-port options)) - (some? (options :resolution)) - (.withResolution (:resolution options)) + (some? (options :resolution)) + (.withResolution (:resolution options)) - (some? (options :request-timeout)) - (.withRequestTimeout (:request-timeout options)) + (some? (options :request-timeout)) + (.withRequestTimeout (:request-timeout options)) - (some? (options :read-buffer-size)) - (.withReadBufferSize (:read-buffer-size options)) + (some? (options :read-buffer-size)) + (.withReadBufferSize (:read-buffer-size options)) - (some? (options :accept-length)) - (.withAcceptLength (:accept-length options)) + (some? (options :accept-length)) + (.withAcceptLength (:accept-length options)) - (some? (options :max-request-size)) - (.withMaxRequestSize (:max-request-size options))) + (some? (options :max-request-size)) + (.withMaxRequestSize (:max-request-size options))) + microhttp-options (.build microhttp-options-builder) microhttp-logger (or (:logger options) (if (:debug options) (DebugLogger.) - (reify Logger - (enabled [_] false) - (log [_ _]) - (log [_ _ _])))) + (NoopLogger/instance))) executor (or (:executor options) (ForkJoinPool/commonPool))] (EventLoop. microhttp-options microhttp-logger