Skip to content

Commit 3a03056

Browse files
committed
Fix bug confusing conn chan with outbound chan
1 parent f16147e commit 3a03056

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/aleph/http/client.clj

+11-8
Original file line numberDiff line numberDiff line change
@@ -737,24 +737,27 @@
737737
;; create a new outbound HTTP2 stream/channel
738738
(-> (.open h2-bootstrap)
739739
netty/wrap-future
740-
(d/chain' (fn [^Http2StreamChannel chan]
740+
(d/chain' (fn [^Http2StreamChannel out-chan]
741+
(log/debug "New outbound HTTP/2 channel available.")
742+
741743
(http2/setup-stream-pipeline
742-
(.pipeline chan)
743-
(http2-client-handler chan resp raw-stream? response-buffer-size)
744+
(.pipeline out-chan)
745+
(http2-client-handler out-chan resp raw-stream? response-buffer-size)
744746
is-server?
745747
proxy-options
746748
logger
747749
pipeline-transform)
748-
ch))
749-
(d/chain' (fn [^Http2StreamChannel chan]
750-
(log/debug "New outbound HTTP/2 channel ready.")
750+
out-chan))
751+
(d/chain' (fn [^Http2StreamChannel out-chan]
752+
(log/debug "New outbound HTTP/2 channel's pipeline configured.")
753+
751754
(if (multipart/is-multipart? req)
752755
(let [emsg "Multipart requests are not yet supported in HTTP/2"
753756
ex (ex-info emsg {:req req})]
754757
(log/error ex emsg)
755758
(throw ex))
756-
#_(@multipart-req-preprocess (assoc req :ch chan)) ; switch to HTTP1 code for multipart
757-
(http2/send-request chan req' resp))))
759+
#_(@multipart-req-preprocess (assoc req :ch out-chan)) ; switch to HTTP1 code for multipart
760+
(http2/send-request out-chan req' resp))))
758761
(d/catch' (fn [^Throwable t]
759762
(log/error t "Unable to open outbound HTTP/2 stream channel")
760763
(d/error! resp t)

src/aleph/http/http2.clj

+2-1
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@
338338
(send-message ch headers body *default-chunk-size* file/*default-file-chunk-size*))
339339
([^Http2StreamChannel ch ^Http2Headers headers body chunk-size file-chunk-size]
340340
(log/trace "http2 send-message")
341+
341342
(let [^Http2FrameStream stream (.stream ch)]
342343
(try
343344
(cond
@@ -414,7 +415,7 @@
414415
(defn send-request
415416
[^Http2StreamChannel ch req response]
416417
(log/trace "http2 send-request fired")
417-
418+
418419
(try
419420
(let [body (if (= :trace (:request-method req))
420421
;; RFC #7231 4.3.8. TRACE

0 commit comments

Comments
 (0)