Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kanarus
Copy link
Member

@kanarus kanarus commented Mar 6, 2025

tested by: *example_with_tcp_listener.rs* sample code in doc comment of Ohkami::howl ( via task test:doc )


This PR enhances Ohkami::howl to be callable with an existing TcpListener, not only ToSocketAddrs-impl items.
Internally introducing IntoTcpListener trait to abstract ToSocketAddrs-impl types and TcpListener itself together.

This enables for users to configure socket to pass to Ohkami::howl e.g. set SO_REUSEADDR

@kanarus kanarus added enhance Update or expand an existing functionality T-Ohkami related to `Ohkami` struct labels Mar 6, 2025
@kanarus kanarus merged commit 046d3da into v0.24 Mar 6, 2025
9 checks passed
@kanarus kanarus deleted the enhance/ohkami/howl-with-existing-TcpListener branch March 6, 2025 22:21
kanarus added a commit that referenced this pull request Aug 27, 2025
* v0.24, edition 2024

* docs(README): mention local fangs more clearly (#403)

* docs(README): add `Typed error` section in `Snippets` (#404)

* docs(README): add `Typed error` section in `Snippets`

* fix sample code

* docs: add `DI by generics` section to README `Snippets` and similar one to `Ohkami` struct doc (#405)

* docs: add `DI by generics` section to README `Snippets` and similar one to `Ohkami` struct doc

* fix sample code

* rename(openapi): `Parameter::maybe_in_*` -> `Parameter::in_*_optional` (#413)

* fix(openapi): correct `APIKey::{query, cookie}`'s `apikey_in:"header"` (#414)

* enhance(worker): Support global bindings arg of `#[worker]` (#416)

* introduce `x_worker::FromEnv`

* add `samples/worker-with-global-bindings` for test

* sucessfully generate `openapi.json` && add test for `samples/worker-with-global-bindings`

* chore: fix account name in CODEOWNERS (#418)

* enhance(openapi): provide default implementation of `openapi_responses` returning empty `Responses` (#419)

* enhance(openapi): allow `#[operation]` to newly set status description (#420)

* enhance(typed): success status with headers (#422)

* enhance(typed): add `with_headers` to success status types

* update doc

* improve doc

* add tests

* fix to avoid empty `CONTENT_TYPE`

* fix to check `B::CONTENT_TYPE.is_empty()` before evaluating `into_body()`

* not run this tests on rt_worker

* enhance(util): improve internal log macros (#424)

* enhance(util): improve internal log macros

* print file, line, column in `DEBUG!`

* enhance(worker): Support wrangler.jsonc (#425)

* enhance(worker): Support wrangler.jsonc

* pass regression tests (toml / by samples/test.sh)

* add `samples/worker-bindings-jsonc` & pass test ( compiles / by samples/test.sh )

* fix test

* refactor(worker): use `Option<&'static str>` instead of unclear string convention (#426)

* docs(worker): mention about first-class support for rt_worker (#427)

* docs(worker): say `wrangler.jsonc` instead of `wrangler.toml` in template description (#428)

* enhance(fangs): set `SendSyncOnNative + 'static` as super trait of `Fang` `Fangs` (#429)

* enhance(ohkami): Support howl with an existing `TcpListener` (#430)

* enhance(ohkami): Support howl with an existing `TcpListener`

* fix sample code in doc comment

* fix typo

* enhance(ohkami): Support single-thread async runtime on multiple threads (#432)

* add regression baseline `examples/multiple=single-threads` (currently only main thread)

* update regression baseline with socket.resueaddr and thread::spawn by num_cpus - 1 (currently panics by multiple CtrlC handlers)

* refactor and extend `sync::CtrlC` impl

* perf: use `RwLock<Vec<AtomicPtr<_` instead of `Mutex<Vec<_`

* fix(request): hardcoded buffer size (#434)

* fix `__rt__::testing::block_on` and related & add `request/_test_parse/test_parse_request_large` (currently fails with `BadRequest` as expected)

* introduce `OHKAMI_REQUEST_BUFSIZE` environment variable instead of hardcoded `const BUFSIZE`

* add warning when failed to parse request headers

* increase default request_bufsize to 1 << 11

* comment out DEBUG

* fix test

* update WARNING message

* create `examples/jwt` and move large-buf test into it

* fix test

* fix test

* refactor(routing): `.Dir()` (#436)

* refactor(routing): `.Dir()`

* comment out DEBUG

* fix cfg

* chore: test `.Dir()` (#437)

* add `TestResponse::content()` & update `examples/static_files` test

* fix `RouteSegment::new`'s validation & add `test_omit_html` `test_serve_dotfiles`

* comment out DEBUG

* fix: check `Content-Length` in `testing` and correctly set `Content-Length` in `StaticFileHandler` of `Dir` (#438)

* enhance(testing): expect `TestResponse::json`'s `serde_json::Result` to be `Ok` (#439)

* enhance(Dir): support conditional fetch (#442)

* enhance(Dir): support conditional fetch with `If-None-Match` `If-Modified-Since`

* next: test conditional fetch impl

* add `Debug` `PartialEq` for `ETag`

* tls: basic tls implementation with tokio-rustls (tokio-only!) (#441)

* enhance(Dir): support conditional fetch with `If-None-Match` `If-Modified-Since`

* next: test conditional fetch impl

* tls: implement basic tls implementation with tokio-rustls (tokio-only!)

* fix(session): fix AsyncRead & AsyncWrite imports for session

* fix(session): fix unsupported WS over TLS & cfg handling

* fix(session): fix trait bounds when ws feature is disabled

* fix(session): omit Send trait to unbreak builds on other runtimes (hopefully)

* fix(etag): merge issues fix

---------

Co-authored-by: kanarus <[email protected]>

* [refactor, chore](tls): tidy cfg, fix doc, test tls feature (#443)

* refactor(tls): tidy cfg, fix doc, test tls feature

* fix test

* docs(tls): update README (#444)

* refactor(session): use per-read timeouts for improved keepalive handling (#445)

* enhance(Dir): Support precompressed files (#447)

* introduce `header::{qvalue, encoding}`

* 2025-04-01 20:21+9:00

* 2025-04-04 01:59+9:00

* skelton

* remove DEBUG

* first, pass existing tests

* todo: test compression handling

* sort `compressed` by file size

* next: test compression handling

* fix AcceptEncoding

* fix Debug and typo

* pass basic tests

* introduce brotli in addition to gzip, and pass tests

* add test cases for 406 Not Acceptable, and pass

* modify comment

* modify test name

* update doc

* skip empty path in `Dir::new`

* fix handling of file extension and canonicalization

* add test cases for precompressed files in subdirectory, and pass

* modify DEBUG print

* remove `async-std` support (#448)

* rename(Ohkami): `howl_tls` to `howls` (#449)

* rename(Ohkami): `howl_tls` to `howls`

* fix doc sample code

* chore: remove `async-std`-related docs and cfgs (#450)

* fix(headers): Corretly handle *overset after deletion* (#455)

* fix(headers): correctly handle overset after deletion

* rm rustc-ice*

* update ./examples/test.sh

* cherry-pick #460 into v0.24 (#461)

* cherry-pick #460

* resolve errors

* handle Keep-Alive timeout log as `DEBUG`, not `WARNING` (#463)

* handle session timeout log as `DEBUG`, not `WARNING`

* WebSocket timeout as WARNING, Keep-Alive timeout as DEBUG

* dx: introduce `INFO!` macro and log around CtrlC as INFO (#464)

* dx: introduce `INFO!` macro and log around CtrlC as INFO

* fix howl_tls and cfg

* dx: make `WARNING!` print `[ohkami:WARNING]`, not `[ohkami:WARNS]` (#465)

* fix(session): revise default timeout config (#466)

* chore(worker): bump `worker` dependency to v0.6 (#475)

* chore(CI): cache sccache directory after the most large task in order to maximize cache hit (#476)

* chore: resolve warnings (#477)

* chore: resolve warnings

* remove unused mut

* enhance(request): return `Response::RequestHeaderFieldsTooLarge` when met unexpected situation in request header parsing (#478)

* docs: specify runtime versions (#484)

* rename(fang, format): follow Rust's naming convention (#485)

* rename(fang, format): follow Rust's naming convention

* rename `EnamelFields`'s fields

* fix code format

* fix very critial typo, thanks to good tests!

* chore(examples): run `cargo check` for all examples before tests for some examples (#486)

* rename(headers): follow Rust's naming convention (#487)

* rename(openapi): follow Rust's naming convention (#488)

* rename(openapi): follow Rust's naming convention

* fix `requestBody` -> `requestbody`

* fix serde rename

* fix typo: external_cocs -> external_docs

* fix `openapi::secirity` method names

* fix oauth flow namings & fangs' security uses

* chore: bump `lambda_runtime` dependency to v0.14 (#489)

* chore: bump `num_cpus` dependency to v1.17 (#490)

* feat: introduce `Path<T>` and obsolete current implicit path params (#493)

* impled skelton; TODO: update all tests, examples, samples and docs

* update docs

* update examples

* fix openapi::Schema generic impls

* update samples

* update tests

* chore(CI): temporarily omit `nio` (#495)

* chore(CI): temporarily omit `nio`

* fix around `benches_rt`

* fix Taskfile's `status` for benches (skip control)

* rename: unify `typed` and `format` modules into `handle` API (#496)

* rename: unify `typed` and `format` module

* update `Query` doc; TODO: update examples, samples, doc sample codes

* rename the unified module to `component`

* 2025-08-07 09:16+9:00

* update doc

* update examples, samples, benches_rt

* update tests

* enhance(handle): impl `FromParam` for `Uuid` by default (#497)

* enhance(handle): impl `FromParam` for `Uuid` by default

* add `impl ohkami_openapi::Schema for uuid::Uuid`

* docs: be sure to setup `Context` in DI sample's entry point (#498)

* docs: be sure to setup `Context` in DI sample's entry point

* fix to pass test

* chore: resolve warnings (#499)

* docs: mention `openapi::Tag` in README (#500)

* enhance(worker): remove `wrangler whoami` call from `worker_openapi.js` (#501)

* enhance(worker): remove `wrangler whoami` call from `worker_openapi.js` and add doc & test of `#[worker]` attribute's documentation args

* improve `#[worker]` doc & add test for only-`servers` arg

* docs: improve `#[worker]` docs and README's `rt_worker` description (#502)

* docs: improve README's `rt_worker` description

* improve README

* mention global bindings pattern in `#[worker]` doc

* docs: improve docs around `FromRequest` (#503)

* rename: `handle` to `claw` (#505)

* rename: `handle` to `claw`

* fix wrong rename

* fix examples

* fix README

* refactor around the `n_params` assertion system (#506)

* refactor around the `n_params` assertion system

* fix test

* dx: put `#[diagnostic::do_not_recommend]` for local fangs' `IntoHandler` impls (#507)

* dx: put `#[diagnostic::do_not_recommend]` for local fangs' `IntoHandler` impls

* restore debug

* docs: improve README (#508)

* docs: improve README (#509)

* refactor: unify where to impl `IntoHandler` (#510)

* dx: `INFO!` log `howl(s)`ed address (#511)

* dx: `INFO!` log `holwl(s)`ed local address

* update examples

* enhance(Route): deprecate `.Dir()` and introduce `.Mount()` (#512)

* enhance(Route): deprecate `.Dir()` and introduce `.Mount()`

* add `: Sized` constraint to `Route`

* complete cfg

* feat(worker): Support Hyperdrive in `#[bindings]` (#513)

* feat(worker): Support Hyperdrive in `#[bindings]`

* remove debug

* docs(openapi): documentation for `Schema` trait (#514)

* docs: follow templates repo's rename (#515)

* docs: improve README (#516)

* docs: improve README

* fix a phrase

* enhance(ws): Support `wss://` (#519)

* enhance(ws): Support `wss://`

* improve TLS accept handling and update examples/websocket

* fix AsyncRead impl

* update `mews` to v0.4.0 and tidy `session::connection`

* chore(CI): add temporal workaround for bug of nightly-2025-08-12 (#522)

* chore(CI): add temporal workaround for bug of nightly-2025-08-12

* do `rustup target add wasm32-unknown-unknown` also for workaround-one

* feat(tls): Support `tls` feature on all native runtimes (#523)

* impl skelton

* update tests

* how to setup test-*.pem for test

* update test

* pass tests & update docs

* chore

* fix typo

* refactor around rt, io, format, logging (#525)

* docs: `#[cfg_attr(docsrs, doc(cfg(feature = "...")))]` (#527)

* rename(util): `timeout_in` into `with_timeout` (#528)

* refactor(request): rename `Request::{init => uninit}` & fix `Pin::{new_unchecked => new}` (#529)

* chore(CI): restore `rt_nio` checks/tests (#530)

* chore(dep): bump `toml` from 0.8 to 0.9 (#531)

* chore(dep): bump `toml` from 0.8 to 0.9

* fix `toml` features

* fix(Mount): `omit_extension`'s doc and behavior to accept both `\.?ext` (#532)

* fix(Mount): `omit_extension`'s doc and behavior to accept both `\.?ext`

* fix deref

* fix slice

* refactor(Ohkami): reorganize `howl` and `howls` (#534)

* tls: unify `howls` to `howl`

* fix inline and doc

* refactor around `howl` and `howls`

* fix doc

* remove unnecessary `impl Into` & improve doc

* feat(fang): Add builtin CSRF protaction fang (#535)

* impl skelton

* add doc and init-validation

* add first test

* complete tests & pass

* fix doc sample code

* dx: add `#[derive]`s for some types (#536)

* docs: A performant, declarative, and runtime-flexible web framework for Rust (#537)

* remove zombie example

* chore: resolve warnings

* chore: fix typo

* pref: `Connection` inlining

* perf: add some #[inline]s

* fix(request): avoid panic in str conversion (#543)

* fix(request): avoid panic in str conversion

* fix `Path`'s `Deref` users

* refactor(header): improve `IndexMap` implementation (into `ByteArrayMap`) and fix benches (#544)

* refactor `header::{IndexMap => ByteArrayMap}`

* introduce `ByteArrayMap::insert_new` and use it in `ResponseHeaders::insert`

* update bench

* update bench

* update response_headers bench

* fix phrases and update some

* refactor(fangs): update `Csrf` doc and `with_trusted_origins` validation (#545)

* refactor(fangs): update `Csrf` docs and registration-validation

* refactor more

* improve panic messages

* refactor(fangs): improve `FangAction` doc and tidy code format (#546)

* update(testing): automatically set `Host` and `Date` header if not set (#547)

* update(testing): automatically set `Host` and `Date` header if not set

* avoid unnecessary unsafe

* rename(testing): `Testing` to `Tester`, `TestingOhkami` to `TestOhkami` (#548)

---------

Co-authored-by: agam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhance Update or expand an existing functionality T-Ohkami related to `Ohkami` struct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant