clj-commons / aleph

Asynchronous streaming communication for Clojure - web server, web client, and raw TCP/UDP
http://aleph.io
MIT License
2.54k stars 241 forks source link

client: Accept empty file #590

Closed arnaudgeiser closed 2 years ago

arnaudgeiser commented 2 years ago

Description

In case of TLS usage (ssl-context) and an empty file, a NullPointerException was raised on the following code because bs/to-byte-buffers was returning nil and a manifold.stream/->source cannot be build from it.

(send-streaming-body ch msg
      (-> file
        (bs/to-byte-buffers {:chunk-size (.-chunk-size file)})
        s/->source))

This issue has been reported here : https://github.com/clj-commons/aleph/issues/559