Commit Graph

271 Commits

Author SHA1 Message Date
Brian Picciano
077565b908 Implemented AsyncReadCapture and AsyncReadWrite
These are utility types which will help capture the ClientHello as it is
being read and parsed, as well as any data following it which might get
buffered in the acceptore. This way we can get that data back out in
case we want to switch into transparent TCP mode again.
2023-07-22 13:40:19 +02:00
Joseph Birr-Pixton
b7289d7e7e Trigger CI run on push to main
Leftover from move from master->main branch name.
2023-06-12 10:25:33 +01:00
Joseph Birr-Pixton
214ca2c94c Update MSRV to 1.60 and test it 2023-06-12 10:25:33 +01:00
Dirkjan Ochtman
15020d31e5 Bump version number to 0.24.1 2023-06-09 11:58:47 +02:00
Dirkjan Ochtman
c669c161cf Bump webpki-roots dev-dependency to 0.23.1 2023-06-09 11:58:47 +02:00
Dirkjan Ochtman
4476f8bc02 Merge branch 'master' for take_io() 2023-06-06 09:23:44 +02:00
Geoff Jacobsen
fcbae20f8c
add: take_io method to LazyConfigAcceptor (#145)
* add: take_io method to LazyConfigAcceptor

The `take_io` method can be used to take back ownership of the client IO stream when an error occurs
during clientHello handshake.

An example of this is when a client tries to connect to an TLS socket expecting it to be plain text
connection. In this case take_io can be used to send a 400 response, "The plain HTTP request was
sent to HTTPS port", back to the client.

* rename test lazy_config_acceptor_take_io
2023-06-06 14:15:07 +08:00
Dirkjan Ochtman
6e9b0529f0 Update links in README 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
5e1b75c5e9 Change repository and homepage to point at rustls 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
3701574b5d Remove authors from Cargo metadata (see RFC 3052) 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
b496e24270 Move tokio-rustls to top level 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
0ce49fa9cd Build examples as part of the crate 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
9c9431be30 Remove tokio-native-tls 2023-05-31 17:09:52 +02:00
Dirkjan Ochtman
c59daba22e Move scripts from tokio-native-tls to tokio-rustls 2023-05-31 17:09:52 +02:00
Shih-Chiang Chien
3fcf85892b
expose rustls secret_extraction feature (#134) 2023-05-23 13:36:01 +02:00
John T. Wodder II
0f00a0c11b
tokio-rustls: Fix "Basic Structure of a Client" code in README (#142) 2023-04-17 09:51:11 +08:00
Paolo Barbolini
7ea7a17831
Remove webpki (#82) 2023-03-31 00:13:12 +08:00
Daniel McCarney
07e8da6e52
update rustls v0.20.7 -> v0.21.0 (#137)
* deps: update to rustls 0.21.0.

This commit updates tokio-rustls to use the freshly released Rustls
0.21.0 release tag, and the rustls-webpki fork of webpki.

* tests: improve server wait in early data test.

Previously the `test_0rtt` test had a hardcoded 1s sleep waiting for an
`openssl s_server` process to become ready.

If 1s waiting wasn't long enough, the test could fail with an error
like:

```
Error: Os { code: 10061, kind: ConnectionRefused, message: "No
connection could be made because the target machine actively refused
it." }
```

This commit replaces the hardcoded sleep with a sleep loop that
gradually increases the delay time up to a fixed maximum. This makes the
test run faster when the server is ready quickly and prevents an error
if it takes longer than 1s to stabilize.

* version: 0.23.4 -> 0.24.0
2023-03-30 17:44:26 +02:00
Dirkjan Ochtman
7dfc981020
tokio-native-tls: remove unused dependencies (#133) 2023-03-30 23:29:17 +08:00
David Cook
357bc56248
Fix early-data test (#132)
* Fix domain name in early-data test

* Run early data test in CI

* Add missing wake call

* Workaround: write to OpenSSL's input

This is necessary to work around an issue that only appears on Windows.

* Don't rerun other tests in CI
2023-02-19 08:40:05 +08:00
nickelc
e3841d6e3a
Replace unmaintained GitHub Actions (#131)
The toolchain is now installed with `dtolnay/rust-toolchain` and
`actions-rs/cargo` is replaced with plain commands.
2023-02-08 12:28:15 -05:00
nickelc
f9d55a686c
chore: update readme links & badges (#49) 2023-02-08 12:27:45 -05:00
Noah Kennedy
3716340633
chore: prepare tokio-native-tls 0.3.1 (#129)
# 0.3.1 (February 4th, 2023)

### Additions
- Add Vendored Feature ([#125])
- Implement AsRawFd for both tokio-rustls and tokio-native-tls TlsStream\<S\> ([#74])

### Internal
- Fix warning about renamed lint ([#93])
- fix a handful of lints, one of which was breaking the build ([#65])

[#65]: https://github.com/tokio-rs/tls/pull/65
[#74]: https://github.com/tokio-rs/tls/pull/74
[#93]: https://github.com/tokio-rs/tls/pull/93
[#125]: https://github.com/tokio-rs/tls/pull/125
2023-02-07 11:05:15 -06:00
John Vandenberg
874478f09a
Bump the test dependencies (#130) 2023-02-06 09:39:21 +01:00
Dirkjan Ochtman
27ec4a3f4f
Clippy 1.67 (#127)
* tokio-rustls: specify rust-version as 1.56 as required by rustls 0.20.7

* tokio-rustls: apply clippy lints for 1.67
2023-01-28 22:10:27 +01:00
Selyatin
df272e9958
Add Vendored Feature (#125) 2022-12-20 12:00:12 -05:00
Alex Touchet
271980ff97
Fix Actions badge and update links (#124) 2022-12-17 14:53:39 +08:00
Dirkjan Ochtman
9d58c7d29e
chore: apply clippy suggestions from 1.65 (#122) 2022-11-04 22:11:05 +01:00
Dirkjan Ochtman
24473eaff9
tokio-rustls: initialize Acceptor with default() in tests (#119) 2022-10-23 13:43:45 +08:00
Dirkjan Ochtman
c033514814
Clippy fixes (#118) 2022-10-11 16:12:04 +02:00
Dirkjan Ochtman
87ecfe7c01
Upgrade to rustls-pemfile 1 (#114) 2022-08-02 22:54:13 +02:00
Taiki Endo
e902e5160d
Update actions/checkout action to v3 (#109) 2022-07-28 17:25:11 +02:00
Dirkjan Ochtman
c2d1fe6813
Refresh test certificates for tokio-rustls (#113)
Used the script in tokio-native-tls/scripts to generate new certs.
2022-07-28 18:51:38 +08:00
Dirkjan Ochtman
ce11bf7274
Fix warning about renamed lint (#93) 2022-05-09 21:57:54 +02:00
quininer
0cf2ccc1ad
tokio-rustls: release 0.23.4 (#105) 2022-05-04 16:34:25 +02:00
Sergio Benitez
f1c7d22ad3
add 'get_ref()' and 'get_mut()' to 'Accept' (#104)
* add 'get_ref()' and 'get_mut()' to 'Accept'

* add 'get_ref()' and 'get_mut()' to 'Connect'
2022-05-04 10:29:52 +08:00
quininer
bcf4f8e3f9
Rustls buffered handshake eof failed (#98)
* rustls/tests: use BufWriter in handshake

* tokio-rustls: move test to stream_buffered_handshake

* Fix tokio-rustls bufwriter handshake fail #96

* Use need_flush

* More flush

* tokio-rustls: release 0.23.3

* Fix fmt

Co-authored-by: tharvik <tharvik@users.noreply.github.com>
2022-03-19 06:09:28 +01:00
quininer
47b2ef50c1
release tokio-rustls 0.23.2 (#88) 2021-12-16 15:35:57 +01:00
Moritz Gunz
fe8a0f4152
fix: Fix EOF spin loop by removing intermediate buffer in LazyConfigAcceptor (#87)
* chore: Remove intermediate buffer in LazyConfigAcceptor

* chore: Document WouldBlock behavior

* chore: satisfy clippy

* chore: Rename Reader -> SyncReadAdapter

* chore: add test for EOF
2021-12-16 21:32:46 +08:00
quininer
8519354ad6
release tokoi-rustls 0.23.1 (#83) 2021-10-30 13:45:10 +02:00
Dirkjan Ochtman
33506018e7
Add LazyConfigAcceptor API (#69) 2021-10-30 08:10:58 +02:00
quininer
48caaf751f
Add poll_write docs (#73) 2021-10-14 20:15:39 +02:00
Dirkjan Ochtman
ea14b430d7
Fix incorrect spelling (#76) 2021-10-12 20:49:28 +08:00
quininer
56855b7166
don't throw eof error to keep consistency (#79) 2021-10-12 10:05:51 +02:00
quininer
5aae337945
Fix #77 regression (#78)
* Add regression test for #77

* Fix handshake alert

* Fix style
2021-10-07 09:45:42 +02:00
quininer
0bf243566d
Fix early-data wakeup loss (#72) 2021-10-05 10:43:54 +02:00
Jerome Gravel-Niquet
438cb8f9c8
Implement AsRawFd for both tokio-rustls and tokio-native-tls TlsStream<S> (#74)
* implement AsRawFd for both tokio-rustls and tokio-native-tls TlsStream<S>

* implement windows' AsRawHandle

* typo in cfg(windows)

* use RawSocket, not RawHandle

* implement AsRawFd & AsRawSocket for tokio_rustls::client::TlsStream and tokio_rustls::TlsStream enum
2021-10-01 21:52:10 +08:00
Eliza Weisman
8501aafae5
[DRAFT] update tokio-rustls to rustls 0.20.x (#64)
* update to rustls 0.20

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* track simple renamings in rustls

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* use reader/writer methods

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* fix find and replace

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* use rustls-pemfile crate for pem file parsing

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update misc api breakage

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update client example with api changes

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update server example with new APIs

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update test_stream test

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update tests to use new APIs

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* rm unused imports

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* handle rustls `WouldBlock` on eof

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* expect rustls to return wouldblock in tests

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* i think this is *actually* the right EOF behavior

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* bump version

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* okay that seems to fix it

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* update to track builder API changes

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* actually shutdown read side on close notify

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* Further updates to rustls 0.20 (#68)

* Adapt to RootCertStore API changes

* Handle UnexpectedEof errors

* Rename would_block to io_pending

* Try to make badssl test failures more verbose

* Rebuild AsyncRead impl

* Upgrade to current rustls

* Revert to using assert!()

* Update to rustls 0.20

* Forward rustls features

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2021-09-29 01:01:37 +08:00
Eliza Weisman
db01bce007
fix a handful of lints, one of which was breaking the build (#65)
* native-tls: fix use of non-fmt panic in tests
* fix some misc. clippy lints

This branch fixes a number of lints. The most important one was the use
of a non-`format_args!` expression in a `panic!` macro, which generates
a compiler warning in recent Rust toolchains, which is breaking the CI
`cargo check` run on PR #64.

While I was here, I also fixed some miscellaneous Clippy lints, mostly
in tests. These include:

* Use of `clone()` on `SocketAddr`s (which implement `Copy`)
* Unnecessary single-path-segment imports (which probably used to be
  `extern crate`s in earlier Rust?)
* `'static` lifetimes in `const` type annotations (`const`s always have
  the `'static` lifetime)

None of these were breaking the build on CI, but I figured I'd address
them while I was fixing other lints.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-06-29 15:45:21 -07:00
Nikhil Benesch
794659740d
tokio-native-tls: prepare v0.3.0 (#47) 2020-12-24 12:13:08 -05:00