Skip to content

Commit d2cb112

Browse files
committed
Release 0.7.0
1 parent b60bcd4 commit d2cb112

File tree

6 files changed

+60
-40
lines changed

6 files changed

+60
-40
lines changed

CHANGES.md

+15-22
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
### 0.7.0-rc2
1+
### 0.7.0
22

3-
* Include Brotli and zstd deps by default, remove code treating them as optional
4-
5-
Contribution by Matthew Davidson.
6-
7-
### 0.7.0-rc1
8-
9-
* Added HTTP/2 server support
3+
* HTTP/2 server support, including ALPN and h2c
4+
* HTTP/2 client support
105
* Support more compression codecs (Brotli, Zstd, and Snappy)
11-
12-
Contributions by Matthew Davidson, Moritz Heidkamp, and Arnaud Geiser.
13-
14-
### 0.7.0-alpha2
15-
16-
* Enable SSL/TLS certificate hostname verification by default in the client. (Warning: This is a BREAKING change for those with misconfigured server certificat~es.)
17-
18-
Contribution by Moritz Heidkamp.
19-
20-
### 0.7.0-alpha1
21-
22-
* Add support for HTTP/2 in the client.
23-
24-
Contributions by Matthew Davidson and Arnaud Geiser.
6+
* Enable SSL/TLS certificate hostname verification by default in the client for
7+
security purposes. (Warning: This is a BREAKING change for those with
8+
misconfigured server certificates.)
9+
* Bump Manifold dep to 0.4.1, which means Aleph/Manifold deferreds now support
10+
CompletionStage for better Java interop
11+
* Bump Netty to 4.1.00.Final
12+
* Improved error logging
13+
14+
Contributions by Matthew Davidson, Moritz Heidkamp, and Arnaud Geiser.
15+
16+
Manifold contributions by Renan Ribeiro, Ryan Smith, Arnaud Geiser, and Matthew
17+
Davidson.
2518

2619
### 0.6.3
2720

README.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Aleph exposes data from the network as a [Manifold](https://github.com/clj-commo
88

99
Leiningen:
1010
```clojure
11-
[aleph "0.7.0-rc2"]
11+
[aleph "0.7.0"]
1212
```
1313
deps.edn:
1414
```clojure
15-
aleph/aleph {:mvn/version "0.7.0-rc2"}
15+
aleph/aleph {:mvn/version "0.7.0"}
1616
;; alternatively
1717
io.github.clj-commons/aleph {:git/sha "..."}
1818
```
@@ -30,17 +30,26 @@ Aleph follows the [Ring](https://github.com/ring-clojure) spec fully, and can be
3030
:headers {"content-type" "text/plain"}
3131
:body "hello!"})
3232

33-
(http/start-server handler {:port 8080})
33+
(http/start-server handler {:port 8080}) ; HTTP/1-only
34+
35+
;; To support HTTP/2, do the following:
36+
;; (def my-ssl-context ...)
37+
(http/start-server handler {:port 443
38+
:http-versions [:http2 :http1]
39+
:ssl-context my-ssl-context})
40+
;; See aleph.examples.http2 for more details
3441
```
3542

3643
The body of the response may also be a Manifold stream, where each message from the stream is sent as a chunk, allowing for precise control over streamed responses for [server-sent events](http://en.wikipedia.org/wiki/Server-sent_events) and other purposes.
3744

45+
3846
#### Client
3947

4048
For HTTP client requests, Aleph models itself after [clj-http](https://github.com/dakrone/clj-http), except that every request immediately returns a Manifold deferred representing the response.
4149

4250
```clojure
4351
(require
52+
'[aleph.http :as http]
4453
'[manifold.deferred :as d]
4554
'[clj-commons.byte-streams :as bs])
4655

@@ -53,6 +62,12 @@ For HTTP client requests, Aleph models itself after [clj-http](https://github.co
5362
:body
5463
bs/to-string
5564
prn)
65+
66+
;; To support HTTP/2, do the following:
67+
(def conn-pool
68+
(http/connection-pool {:connection-options {:http-versions [:http2 :http1]}}))
69+
@(http/get "https://google.com" {:pool conn-pool})
70+
;; See aleph.examples.http2 for more details
5671
```
5772

5873
Aleph attempts to mimic the clj-http API and capabilities fully. It supports multipart/form-data requests, cookie stores, proxy servers and requests inspection with a few notable differences:
@@ -77,6 +92,22 @@ Aleph client also supports fully async and [highly customizable](https://github.
7792

7893
To learn more, [read the example code](https://github.com/clj-commons/aleph/blob/master/examples/src/aleph/examples/http.clj).
7994

95+
#### HTTP/2
96+
97+
As of 0.7.0, Aleph supports HTTP/2 in both the client and the server.
98+
99+
For the most part, Aleph's HTTP/2 support is a drop-in replacement for HTTP/1. For backwards compatibility, though, Aleph defaults to HTTP/1-only. See the [the example HTTP/2 code](https://github.com/clj-commons/aleph/blob/master/examples/src/aleph/examples/http2.clj) for a good overview on getting started with HTTP/2.
100+
101+
Things to be aware of:
102+
103+
1. Multipart uploads are not yet supported under HTTP/2, because Netty doesn't support them under HTTP/2. For new development, open a new H2 stream/request for each file instead. (HTTP/2 generally doesn't need multipart, since it doesn't have the same limitations on the number of connections as HTTP/1.) For existing multipart code, stick with HTTP/1. Ideally, this will be added in a future release.
104+
2. Aleph does not currently support the CONNECT method under HTTP/2. Stick with HTTP/1 if you're using CONNECT.
105+
3. Aleph will not support HTTP/2 server push, since it's deprecated, and effectively disabled by Chrome.
106+
4. Aleph does not currently support HTTP/2 trailers (headers arriving after the body).
107+
5. Aleph does nothing with priority information. We would like to expose an API to support user use of prioritization, but the browsers never agreed on how to interpret them, and some (e.g., Safari) effectively never used them. We think back-porting the HTTP/3 priority headers to HTTP/2 is a better aim.
108+
6. Aleph currently uses Netty's default flow control. This is a 64 kb window, which with bytes acknowledged as soon they're received. We plan to add support for adjusting the default window size and flow control strategy in a future release.
109+
7. If you were using `pipeline-transform` to alter the underlying Netty pipeline, you will need to check your usage of it for HTTP/2. Under the hood, the new HTTP/2 code uses Netty's multiplexed pipeline setup, with a shared connection-level pipeline that feeds stream-specific frames to N pipelines created for N individual streams. (A standard HTTP request/response pair maps to a single H2 stream.)
110+
80111
### WebSockets
81112

82113
On any HTTP request which has the proper `Upgrade` headers, you may call `(aleph.http/websocket-connection req)`, which returns a deferred which yields a **duplex stream**, which uses a single stream to represent bidirectional communication. Messages from the client can be received via `take!`, and sent to the client via `put!`. An echo WebSocket handler, then, would just consist of:
@@ -136,6 +167,6 @@ Minimal [`tools.deps`](https://github.com/clojure/tools.deps.alpha) support is a
136167

137168
### License
138169

139-
Copyright © 2010-2023 Zachary Tellman
170+
Copyright © 2010-2024 Zachary Tellman
140171

141172
Distributed under the MIT License

adr/adr-001-http2.adoc

+6-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Date: 2023-04-10
55

66
== Status
77

8-
#Proposed#
8+
#Accepted#
99

1010
A decision may be "proposed" if the project stakeholders haven't agreed with it
1111
yet, or "accepted" once it is agreed. If a later ADR changes or reverses a
@@ -94,15 +94,11 @@ HTTP/2 supports CONNECT proxying, but over a single HTTP/2 stream, not a whole T
9494
=== Backwards-compatibility mode
9595

9696
We will maintain a backwards-compatible API for the majority of users, where
97-
their existing handlers will work as is. All streams will have equal priority,
98-
and flow control will ...
99-
100-
NOTE: What should the default flow control strategy be? An infinitely large
101-
window? The default 64kb window, that auto-replenishes as soon as bytes are read
102-
off? Netty offers both of the previous as default strategies available for use.
103-
104-
NOTE: What should a raw stream look like? A sequence of ByteBufs? Or a sequence
105-
of Frames, which is Netty's "raw" level for HTTP/2?
97+
their existing Ring handlers will work as is. All streams will have equal
98+
priority, and flow control will use the default Netty policy of a 64 kb window,
99+
that auto-replenishes as soon as bytes are read off. Users will be able to
100+
adjust the initial window size. Ring maps will still be used in the normal mode,
101+
and ByteBufs will still be used in raw mode.
106102

107103
=== HTTP/2 connection mode
108104
We will NOT support server push, as our resources are too limited relative to

examples/project.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
(defproject aleph.examples "0.7.0-rc2"
2-
:dependencies [[aleph "0.7.0-rc2"]
1+
(defproject aleph.examples "0.7.0"
2+
:dependencies [[aleph "0.7.0"]
33
[gloss "0.2.6"]
44
[metosin/reitit "0.5.18"]
55
[org.clojure/clojure "1.11.1"]

project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(def brotli-version "1.12.0")
44

55

6-
(defproject aleph (or (System/getenv "PROJECT_VERSION") "0.7.0-rc2")
6+
(defproject aleph (or (System/getenv "PROJECT_VERSION") "0.7.0")
77
:description "A framework for asynchronous communication"
88
:url "https://github.com/clj-commons/aleph"
99
:license {:name "MIT License"}

src/aleph/http/common.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
(set! *warn-on-reflection* true)
2929

30-
(def aleph-server-header "Aleph value for the Server header" (AsciiString. "Aleph/0.7.0-rc2"))
30+
(def aleph-server-header "Aleph value for the Server header" (AsciiString. "Aleph/0.7.0"))
3131

3232
(defprotocol HeaderMap
3333
(get-header-values [m ^String k]))

0 commit comments

Comments
 (0)