diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ac739a..5bb78903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,44 @@ For a list of breaking changes, check [here](#breaking-changes) +## v0.2.1 (SNAPSHOT) + +Pre-release binaries: + +- [Linux](https://11913-201467090-gh.circle-artifacts.com/0/release/babashka-0.2.1-SNAPSHOT-linux-amd64.zip) +- [macOS](https://11914-201467090-gh.circle-artifacts.com/0/release/babashka-0.2.1-SNAPSHOT-macos-amd64.zip) +- [Windows](https://ci.appveyor.com/api/buildjobs/wjhyh3acqi14dbex/artifacts/babashka-0.2.1-SNAPSHOT-windows-amd64.zip) + +Thanks to [@RickMoynihan](https://github.com/RickMoynihan), [@joinr](https://github.com/joinr), [@djblue](https://github.com/djblue), [@lread](https://github.com/lread), [@teodorlu](https://github.com/teodorlu) for contributing to this release. Thanks to [Clojurists Together](https://www.clojuriststogether.org/) for sponsoring this release. + +### New + +- Include `org.httpkit.client`, a high performance async http client [#561](https://github.com/borkdude/babashka/issues/561) +- Include `org.httpkit.server`, an HTTP server + [#556](https://github.com/borkdude/babashka/issues/556). This namespace should + be considered experimental and may stay or be removed in a future version of + babashka, depending on feedback from the community. See [example](examples/httpkit_server.clj) +- Add `java.io.FileNotFoundException`, `java.security.DigestInputStream`, `java.nio.file.FileVisitOption` classes +- Support implementing `IDeref`, `IAtom` and `IAtom2` on records [sci#401](https://github.com/borkdude/sci/issues/401) +- Support compatibility with [version-clj](https://github.com/xsc/version-clj) [#565](https://github.com/borkdude/babashka/issues/565) [@lread](https://github.com/lread) and [@borkdude](https://github.com/borkdude) +- Support YAML roundtrip through `*input*` [#583](https://github.com/borkdude/babashka/issues/583) +- Support `clojure.core/find-var` [sci#420](https://github.com/borkdude/sci/issues/420) [@RickMoynihan](https://github.com/RickMoynihan) + +### Fixed / enhanced + +- Fix location printing in REPL (`--repl`) [#577](https://github.com/borkdude/babashka/issues/577) +- Babashka.curl sends form params incorrectly as multipart [babashka.curl#25](https://github.com/borkdude/babashka.curl/issues/25) +- Update Windows build instructions [#574](https://github.com/borkdude/babashka/issues/574) +- Set minimum macOS version in build explicitly [#588](https://github.com/borkdude/babashka/pull/588) +- Fix NPE in error handling logic [#587](https://github.com/borkdude/babashka/issues/587) +- Fix namespace switch in REPL (`--repl`) [#564](https://github.com/borkdude/babashka/issues/564) +- Fix location of errors in REPL (`--repl`) [#589](https://github.com/borkdude/babashka/issues/589) +- Support multi-arity methods in `defprotocol` [sci#406](https://github.com/borkdude/sci/issues/406) +- Constructor call not recognized in protocol impl [sci#419](https://github.com/borkdude/sci/issues/419) +- Improve handling of top-level do in macro expansion [sci#421](https://github.com/borkdude/sci/issues/421) +- Performance improvements suggested by [@joinr](https://github.com/joinr) [sci#415](https://github.com/borkdude/sci/issues/415) +- Throw when trying to redefine referred var [sci#398](https://github.com/borkdude/sci/issues/398) + ## v0.2.0 (2020-08-28) Thanks to [@cldwalker](https://github.com/cldwalker), [@dehli](https://github.com/dehli), [@djblue](https://github.com/djblue), [@GomoSDG](https://github.com/GomoSDG), [@grahamcarlyle](https://github.com/grahamcarlyle), [@j-cr](https://github.com/j-cr), diff --git a/README.md b/README.md index 808521d6..edb25e5a 100644 --- a/README.md +++ b/README.md @@ -815,7 +815,11 @@ resources than on the JVM and will break down for some high value of `n`: For making HTTP requests you can use: - [babashka.curl](https://github.com/borkdude/babashka.curl). This library is - included with babashka and aliased as `curl` in the user namespace. + included with babashka and aliased as `curl` in the user namespace. The + interface is similar to that of + [clj-http](https://github.com/dakrone/clj-http) but it will shell out to + `curl` to make requests. +- [org.httpkit.client](https://github.com/http-kit/http-kit) - `slurp` for simple `GET` requests - [clj-http-lite](https://github.com/borkdude/clj-http-lite) as a library. - `clojure.java.shell` or `java.lang.ProcessBuilder` for shelling out to your diff --git a/examples/http_server.clj b/examples/http_server.clj index fecae0a0..213f6d5e 100755 --- a/examples/http_server.clj +++ b/examples/http_server.clj @@ -3,21 +3,22 @@ ;; This example creates a file serving web server ;; It accepts a single connection from a browser and serves content to the connected browser ;; after the connection times out, this script will serve no more. +;; Also see notes.clj for another web app example. (import (java.net ServerSocket)) -(require '[clojure.string :as string] - '[clojure.java.io :as io]) +(require '[clojure.java.io :as io] + '[clojure.string :as string]) (with-open [server-socket (new ServerSocket 8080) client-socket (.accept server-socket)] (loop [] (let [out (io/writer (.getOutputStream client-socket)) in (io/reader (.getInputStream client-socket)) - [req-line & headers] (loop [headers []] - (let [line (.readLine in)] - (if (string/blank? line) - headers - (recur (conj headers line))))) + [req-line & _headers] (loop [headers []] + (let [line (.readLine in)] + (if (string/blank? line) + headers + (recur (conj headers line))))) [_ _ path _] (re-find #"([^\s]+)\s([^\s]+)\s([^\s]+)" req-line) f (io/file (format "./%s" path)) status (if (.exists f) @@ -46,9 +47,10 @@ (apply html :pre (for [i (.list f)] (html :div - (html :a - {:href (str (if (> (count path) 1) path) "/" i)} i) - ))))))))] + (html + :a + {:href + (str (when (> (count path) 1) path) "/" i)} i)))))))))] (prn path) (.write out (format "HTTP/1.1 %s OK\r\nContent-Length: %s\r\n\r\n%s" status diff --git a/examples/httpkit_server.clj b/examples/httpkit_server.clj new file mode 100644 index 00000000..5172b8ca --- /dev/null +++ b/examples/httpkit_server.clj @@ -0,0 +1,17 @@ +(System/setProperty "babashka.httpkit-server.warning" "false") + +(ns examples.httpkit-server + (:require [clojure.pprint :refer [pprint]] + [org.httpkit.server :as server])) + +(defn handler [req] + (let [reply (str (slurp "examples/httpkit_server.clj") + "---\n\n" + (with-out-str (pprint (dissoc req + :headers + :async-channel))))] + {:body reply})) + +(server/run-server handler {:port 8090}) +@(promise) ;; wait until SIGINT +