├── .cargo └── config.toml ├── .github ├── PULL_REQUEST_TEMPLATE ├── dependabot.yml └── workflows │ └── CI.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── crates ├── yaws-run-lunatic │ ├── Cargo.toml │ ├── README.md │ ├── TODO.txt │ └── src │ │ ├── lib.rs │ │ ├── tcp.rs │ │ └── webrtc.rs ├── yaws-run-uring │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── lib.rs ├── yaws-spec-h1 │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── http │ │ ├── client.rs │ │ └── parser.rs │ │ └── lib.rs ├── yaws-spec-h2 │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── lib.rs └── yaws │ ├── Cargo.toml │ ├── README.md │ └── src │ └── main.rs └── squat └── yaws-run ├── Cargo.toml ├── README.md └── src └── lib.rs /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.wasm32-wasi] 2 | runner = "lunatic run" -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/.github/PULL_REQUEST_TEMPLATE -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "cargo" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | time: "02:00" # UTC 8 | reviewers: 9 | - "pinkforest" 10 | assignees: 11 | - "pinkforest" 12 | labels: 13 | - "domain: deps" 14 | commit-message: 15 | prefix: "* RoboYak deps" 16 | - package-ecosystem: "github-actions" 17 | directory: "/" 18 | schedule: 19 | interval: "daily" 20 | labels: 21 | - "domain: ci" 22 | commit-message: 23 | prefix: "* RoboYak CI" 24 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - main 7 | env: 8 | RUST_BACKTRACE: 1 9 | 10 | jobs: 11 | ci-pass: 12 | name: CI is green 13 | runs-on: ubuntu-latest 14 | needs: 15 | - style 16 | - test 17 | - doc 18 | steps: 19 | - run: exit 0 20 | 21 | style: 22 | name: Check Styles 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | 28 | - name: Install Rust 29 | uses: dtolnay/rust-toolchain@stable 30 | with: 31 | toolchain: stable 32 | components: clippy, rustfmt 33 | 34 | - name: cargo fmt --check 35 | uses: actions-rs/cargo@v1 36 | with: 37 | command: fmt 38 | args: --all -- --check 39 | 40 | test: 41 | name: Test ${{ matrix.rust }} on ${{ matrix.os }} 42 | needs: [style] 43 | env: 44 | RUN_MODE: development 45 | RUST_BACKTRACE: 1 46 | 47 | strategy: 48 | matrix: 49 | rust: 50 | - stable 51 | - beta 52 | - nightly 53 | - 1.60 54 | 55 | os: 56 | - ubuntu-latest 57 | - windows-latest 58 | - macOS-latest 59 | 60 | include: 61 | - rust: stable 62 | features: "--features full" 63 | os: ubuntu-latest 64 | - rust: beta 65 | features: "--features full" 66 | os: ubuntu-latest 67 | - rust: nightly 68 | features: "--features full,nightly" 69 | benches: true 70 | os: ubuntu-latest 71 | - rust: 1.47 72 | features: "--features full" 73 | os: ubuntu-latest 74 | 75 | runs-on: ${{ matrix.os }} 76 | 77 | steps: 78 | - name: Checkout 79 | uses: actions/checkout@v2.4.0 80 | 81 | - name: Install Rust (${{ matrix.rust }}) 82 | uses: actions-rs/toolchain@v1 83 | with: 84 | profile: minimal 85 | toolchain: ${{ matrix.rust }} 86 | override: true 87 | 88 | - name: Test 89 | uses: actions-rs/cargo@v1 90 | with: 91 | command: test 92 | args: ${{ matrix.features }} 93 | 94 | - name: Test all benches 95 | if: matrix.benches 96 | uses: actions-rs/cargo@v1 97 | with: 98 | command: test 99 | args: --benches ${{ matrix.features }} 100 | 101 | doc: 102 | name: Build docs 103 | needs: [style, test] 104 | runs-on: ubuntu-latest 105 | steps: 106 | - name: Checkout 107 | uses: actions/checkout@v2.4.0 108 | 109 | - name: Install Rust 110 | uses: actions-rs/toolchain@v1 111 | with: 112 | profile: minimal 113 | toolchain: nightly 114 | override: true 115 | 116 | - name: cargo doc 117 | uses: actions-rs/cargo@v1 118 | with: 119 | command: rustdoc 120 | args: --features full 121 | 122 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.1.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 25 | 26 | [[package]] 27 | name = "backtrace" 28 | version = "0.3.69" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" 31 | dependencies = [ 32 | "addr2line", 33 | "cc", 34 | "cfg-if", 35 | "libc", 36 | "miniz_oxide", 37 | "object", 38 | "rustc-demangle", 39 | ] 40 | 41 | [[package]] 42 | name = "bincode" 43 | version = "1.3.3" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" 46 | dependencies = [ 47 | "serde", 48 | ] 49 | 50 | [[package]] 51 | name = "bitflags" 52 | version = "1.3.2" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 55 | 56 | [[package]] 57 | name = "cc" 58 | version = "1.0.83" 59 | source = "registry+https://github.com/rust-lang/crates.io-index" 60 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 61 | dependencies = [ 62 | "libc", 63 | ] 64 | 65 | [[package]] 66 | name = "cfg-if" 67 | version = "1.0.0" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 70 | 71 | [[package]] 72 | name = "convert_case" 73 | version = "0.6.0" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" 76 | dependencies = [ 77 | "unicode-segmentation", 78 | ] 79 | 80 | [[package]] 81 | name = "darling" 82 | version = "0.14.4" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" 85 | dependencies = [ 86 | "darling_core", 87 | "darling_macro", 88 | ] 89 | 90 | [[package]] 91 | name = "darling_core" 92 | version = "0.14.4" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" 95 | dependencies = [ 96 | "fnv", 97 | "ident_case", 98 | "proc-macro2", 99 | "quote", 100 | "strsim", 101 | "syn 1.0.109", 102 | ] 103 | 104 | [[package]] 105 | name = "darling_macro" 106 | version = "0.14.4" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" 109 | dependencies = [ 110 | "darling_core", 111 | "quote", 112 | "syn 1.0.109", 113 | ] 114 | 115 | [[package]] 116 | name = "fnv" 117 | version = "1.0.7" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 120 | 121 | [[package]] 122 | name = "gimli" 123 | version = "0.28.0" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" 126 | 127 | [[package]] 128 | name = "ident_case" 129 | version = "1.0.1" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 132 | 133 | [[package]] 134 | name = "io-uring" 135 | version = "0.5.13" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "dd1e1a01cfb924fd8c5c43b6827965db394f5a3a16c599ce03452266e1cf984c" 138 | dependencies = [ 139 | "bitflags", 140 | "libc", 141 | ] 142 | 143 | [[package]] 144 | name = "libc" 145 | version = "0.2.148" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" 148 | 149 | [[package]] 150 | name = "lunatic" 151 | version = "0.14.1" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "bbe719e7cb256d07d1a0e1e4b096849a07b128bbb6c7ae8756120b650fbd151e" 154 | dependencies = [ 155 | "bincode", 156 | "lunatic-macros", 157 | "lunatic-sys", 158 | "lunatic-test", 159 | "paste", 160 | "rustversion", 161 | "serde", 162 | "thiserror", 163 | ] 164 | 165 | [[package]] 166 | name = "lunatic-macros" 167 | version = "0.13.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "5a7ddb2dbdcd909a3f9667b3616d7dc103eea47a641bca1d3bb6fe11b915b798" 170 | dependencies = [ 171 | "convert_case", 172 | "darling", 173 | "proc-macro2", 174 | "quote", 175 | "syn 1.0.109", 176 | ] 177 | 178 | [[package]] 179 | name = "lunatic-sys" 180 | version = "0.14.0" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "d572d8b5fa4693714650d42566863cf218bb69119d5d8514129972ee00c75ada" 183 | 184 | [[package]] 185 | name = "lunatic-test" 186 | version = "0.13.0" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "31e0c9aa5a17dba90ef8685013d28589d54f04b028f9b3f58c3223e8bf00827d" 189 | dependencies = [ 190 | "quote", 191 | "syn 1.0.109", 192 | ] 193 | 194 | [[package]] 195 | name = "memchr" 196 | version = "2.6.3" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" 199 | 200 | [[package]] 201 | name = "miniz_oxide" 202 | version = "0.7.1" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 205 | dependencies = [ 206 | "adler", 207 | ] 208 | 209 | [[package]] 210 | name = "mio" 211 | version = "0.8.8" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" 214 | dependencies = [ 215 | "libc", 216 | "wasi", 217 | "windows-sys", 218 | ] 219 | 220 | [[package]] 221 | name = "object" 222 | version = "0.32.1" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" 225 | dependencies = [ 226 | "memchr", 227 | ] 228 | 229 | [[package]] 230 | name = "paste" 231 | version = "1.0.14" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 234 | 235 | [[package]] 236 | name = "pin-project-lite" 237 | version = "0.2.13" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 240 | 241 | [[package]] 242 | name = "proc-macro2" 243 | version = "1.0.67" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" 246 | dependencies = [ 247 | "unicode-ident", 248 | ] 249 | 250 | [[package]] 251 | name = "quote" 252 | version = "1.0.33" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 255 | dependencies = [ 256 | "proc-macro2", 257 | ] 258 | 259 | [[package]] 260 | name = "rustc-demangle" 261 | version = "0.1.23" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 264 | 265 | [[package]] 266 | name = "rustversion" 267 | version = "1.0.14" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 270 | 271 | [[package]] 272 | name = "scoped-tls" 273 | version = "1.0.1" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 276 | 277 | [[package]] 278 | name = "serde" 279 | version = "1.0.188" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" 282 | dependencies = [ 283 | "serde_derive", 284 | ] 285 | 286 | [[package]] 287 | name = "serde_derive" 288 | version = "1.0.188" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" 291 | dependencies = [ 292 | "proc-macro2", 293 | "quote", 294 | "syn 2.0.37", 295 | ] 296 | 297 | [[package]] 298 | name = "slab" 299 | version = "0.4.9" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 302 | dependencies = [ 303 | "autocfg", 304 | ] 305 | 306 | [[package]] 307 | name = "socket2" 308 | version = "0.4.9" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 311 | dependencies = [ 312 | "libc", 313 | "winapi", 314 | ] 315 | 316 | [[package]] 317 | name = "socket2" 318 | version = "0.5.4" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" 321 | dependencies = [ 322 | "libc", 323 | "windows-sys", 324 | ] 325 | 326 | [[package]] 327 | name = "strsim" 328 | version = "0.10.0" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 331 | 332 | [[package]] 333 | name = "syn" 334 | version = "1.0.109" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 337 | dependencies = [ 338 | "proc-macro2", 339 | "quote", 340 | "unicode-ident", 341 | ] 342 | 343 | [[package]] 344 | name = "syn" 345 | version = "2.0.37" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" 348 | dependencies = [ 349 | "proc-macro2", 350 | "quote", 351 | "unicode-ident", 352 | ] 353 | 354 | [[package]] 355 | name = "thiserror" 356 | version = "1.0.48" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" 359 | dependencies = [ 360 | "thiserror-impl", 361 | ] 362 | 363 | [[package]] 364 | name = "thiserror-impl" 365 | version = "1.0.48" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" 368 | dependencies = [ 369 | "proc-macro2", 370 | "quote", 371 | "syn 2.0.37", 372 | ] 373 | 374 | [[package]] 375 | name = "tokio" 376 | version = "1.32.0" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" 379 | dependencies = [ 380 | "backtrace", 381 | "libc", 382 | "mio", 383 | "pin-project-lite", 384 | "socket2 0.5.4", 385 | "windows-sys", 386 | ] 387 | 388 | [[package]] 389 | name = "tokio-uring" 390 | version = "0.4.0" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "0d5e02bb137e030b3a547c65a3bd2f1836d66a97369fdcc69034002b10e155ef" 393 | dependencies = [ 394 | "io-uring", 395 | "libc", 396 | "scoped-tls", 397 | "slab", 398 | "socket2 0.4.9", 399 | "tokio", 400 | ] 401 | 402 | [[package]] 403 | name = "unicode-ident" 404 | version = "1.0.12" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 407 | 408 | [[package]] 409 | name = "unicode-segmentation" 410 | version = "1.10.1" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 413 | 414 | [[package]] 415 | name = "wasi" 416 | version = "0.11.0+wasi-snapshot-preview1" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 419 | 420 | [[package]] 421 | name = "winapi" 422 | version = "0.3.9" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 425 | dependencies = [ 426 | "winapi-i686-pc-windows-gnu", 427 | "winapi-x86_64-pc-windows-gnu", 428 | ] 429 | 430 | [[package]] 431 | name = "winapi-i686-pc-windows-gnu" 432 | version = "0.4.0" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 435 | 436 | [[package]] 437 | name = "winapi-x86_64-pc-windows-gnu" 438 | version = "0.4.0" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 441 | 442 | [[package]] 443 | name = "windows-sys" 444 | version = "0.48.0" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 447 | dependencies = [ 448 | "windows-targets", 449 | ] 450 | 451 | [[package]] 452 | name = "windows-targets" 453 | version = "0.48.5" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 456 | dependencies = [ 457 | "windows_aarch64_gnullvm", 458 | "windows_aarch64_msvc", 459 | "windows_i686_gnu", 460 | "windows_i686_msvc", 461 | "windows_x86_64_gnu", 462 | "windows_x86_64_gnullvm", 463 | "windows_x86_64_msvc", 464 | ] 465 | 466 | [[package]] 467 | name = "windows_aarch64_gnullvm" 468 | version = "0.48.5" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 471 | 472 | [[package]] 473 | name = "windows_aarch64_msvc" 474 | version = "0.48.5" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 477 | 478 | [[package]] 479 | name = "windows_i686_gnu" 480 | version = "0.48.5" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 483 | 484 | [[package]] 485 | name = "windows_i686_msvc" 486 | version = "0.48.5" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 489 | 490 | [[package]] 491 | name = "windows_x86_64_gnu" 492 | version = "0.48.5" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 495 | 496 | [[package]] 497 | name = "windows_x86_64_gnullvm" 498 | version = "0.48.5" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 501 | 502 | [[package]] 503 | name = "windows_x86_64_msvc" 504 | version = "0.48.5" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 507 | 508 | [[package]] 509 | name = "yaws" 510 | version = "0.0.0-202301.Jan.15" 511 | dependencies = [ 512 | "lunatic", 513 | "yaws-run-lunatic", 514 | "yaws-run-uring", 515 | ] 516 | 517 | [[package]] 518 | name = "yaws-run-lunatic" 519 | version = "0.0.0-202301.Jan.15" 520 | dependencies = [ 521 | "lunatic", 522 | "serde", 523 | ] 524 | 525 | [[package]] 526 | name = "yaws-run-uring" 527 | version = "0.0.0-202301.Jan.15" 528 | dependencies = [ 529 | "tokio-uring", 530 | ] 531 | 532 | [[package]] 533 | name = "yaws-spec-h1" 534 | version = "0.0.0-202301.Jan.15" 535 | 536 | [[package]] 537 | name = "yaws-spec-h2" 538 | version = "0.0.0-202301.Jan.15" 539 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | exclude = ["squat/yaws-run"] 3 | members = ["crates/*"] 4 | 5 | resolver = "2" -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017-2020 fd developers 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2021 gis_puller contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yaws - an environment-neutral Web server capability 2 | 3 | [![CI](https://github.com/pinkforest/yaws/actions/workflows/CI.yml/badge.svg)](https://github.com/yaws-rs/yaws/actions/workflows/CI.yml) 4 | [![Crates.io](https://img.shields.io/crates/v/yaws.svg)](https://crates.io/crates/yaws) 5 | [![Docs](https://docs.rs/yaws/badge.svg)](https://docs.rs/yaws) 6 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 7 | [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 8 | ![MSRV](https://img.shields.io/badge/MSRV-1.60.0-blue) 9 | 10 | HTTP is everywhere, from embedded to big iron. 11 | 12 | Yaws is a harmonized environment-neutral open source HTTP server capability. 13 | 14 | Yaws through it's different flabors is able to be provided through modern WebAssembly, io_uring, microkernel, RISC-V, embedded runtimes often without POSIX, standard library or operating system support. 15 | 16 | Yaws democratizes HTTP by providing HTTP server capability in these domains, allowing everyone to integrate modern HTTP interface safely and securely into where ever and whatever they build that requires a HTTP server capability. 17 | 18 | See [Yaws Book](https://yaws-rs.github.io/book) for more. 19 | 20 | ## License 21 | 22 | Licensed under either of: 23 | 24 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 25 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 26 | 27 | ### Contribution 28 | 29 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. 30 | 31 | -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws-run-lunatic" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server HTTP/1 spec" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [package.metadata.docs.rs] 17 | features = [] 18 | rustdoc-args = ["--cfg", "docsrs"] 19 | 20 | [dependencies] 21 | lunatic = { version = "0.14" } 22 | serde = { version = "1.0" } -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws-run-lunatic/README.md -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/TODO.txt: -------------------------------------------------------------------------------- 1 | https://docs.rs/lunatic-process/latest/lunatic_process/runtimes/wasmtime/struct.WasmtimeCompiledModule.html 2 | https://docs.rs/lunatic-process/latest/lunatic_process/wasm/fn.spawn_wasm.html 3 | -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg(yaws_tcp = "1")] 2 | mod tcp; 3 | 4 | #[cfg(yaws_webrtc = "1")] 5 | mod webrtc; 6 | 7 | pub fn run() { 8 | #[cfg(yaws_webrtc = "1")] 9 | webrtc::WebRTCServer::new("192.168.88.252:9998").spawn(); 10 | #[cfg(yaws_webrtc = "1")] 11 | webrtc::WebRTCServer::new("127.0.0.1:9998").spawn(); 12 | 13 | #[cfg(yaws_tcp = "1")] 14 | tcp::TcpServer::new("127.0.0.1:9999").spawn(); 15 | } 16 | -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/src/tcp.rs: -------------------------------------------------------------------------------- 1 | use lunatic::{net, spawn_link, Mailbox}; 2 | use std::io::{BufRead, BufReader, Write}; 3 | 4 | #[derive(serde::Serialize, serde::Deserialize)] 5 | pub(crate) struct TcpServer { 6 | local_address: String, 7 | } 8 | 9 | impl TcpServer { 10 | pub(crate) fn new(local_address: &str) -> Self { 11 | TcpServer { 12 | local_address: local_address.to_owned(), 13 | } 14 | } 15 | pub(crate) fn spawn(self) { 16 | spawn_link!(|input = self| listen(input)); 17 | } 18 | } 19 | 20 | #[derive(serde::Serialize, serde::Deserialize)] 21 | struct TcpPeer { 22 | tcp_stream: lunatic::net::TcpStream, 23 | peer: std::net::SocketAddr, 24 | } 25 | 26 | // Creates a TcpServer Listener that spawns TcpPeers upon accept 27 | fn listen(input: TcpServer) { 28 | let listener = net::TcpListener::bind(input.local_address.clone()).unwrap(); 29 | println!("Listening on addr: {}", listener.local_addr().unwrap()); 30 | 31 | while let Ok((tcp_stream, peer)) = listener.accept() { 32 | println!("Accepted peer {} on addr: {}", peer, &input.local_address); 33 | 34 | let tcp_peer = TcpPeer { tcp_stream, peer }; 35 | 36 | spawn_link!(|input = tcp_peer | respond(input)); 37 | } 38 | } 39 | 40 | // Respond back to Line buffered input 41 | fn respond(mut peer: TcpPeer) { 42 | let mut buf_reader = BufReader::new(peer.tcp_stream.clone()); 43 | loop { 44 | let mut buffer = String::new(); 45 | let read = buf_reader.read_line(&mut buffer).unwrap(); 46 | if buffer.contains("exit") || read == 0 { 47 | return; 48 | } 49 | peer.tcp_stream.write_all(buffer.as_bytes()).unwrap(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /crates/yaws-run-lunatic/src/webrtc.rs: -------------------------------------------------------------------------------- 1 | use lunatic::{net, spawn_link, Mailbox}; 2 | 3 | #[derive(serde::Serialize, serde::Deserialize)] 4 | pub(crate) struct WebRTCServer { 5 | local_address: String, 6 | } 7 | 8 | impl WebRTCServer { 9 | pub(crate) fn new(local_address: &str) -> Self { 10 | WebRTCServer { 11 | local_address: local_address.to_owned(), 12 | } 13 | } 14 | pub(crate) fn spawn(self) { 15 | spawn_link!(|me = self| bind(me)); 16 | } 17 | } 18 | 19 | // Binds the WebRTCServer 20 | fn bind(input: WebRTCServer) { 21 | let bound_srv = net::UdpSocket::bind(input.local_address.clone()).unwrap(); 22 | println!("Bound on addr: {}", bound_srv.local_addr().unwrap()); 23 | 24 | let mut in_buf = [0; 9100]; 25 | 26 | while let Ok((bytec, peer)) = bound_srv.recv_from(&mut in_buf) { 27 | println!( 28 | "Received [{}] from peer {} on addr: {}", 29 | bytec, peer, &input.local_address 30 | ); 31 | 32 | let recvd_buf = &mut in_buf[..bytec]; 33 | 34 | let dbg_buf = String::from_utf8_lossy(recvd_buf); 35 | 36 | dbg!(dbg_buf); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /crates/yaws-run-uring/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws-run-uring" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server HTTP/1 spec" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [features] 17 | 18 | [package.metadata.docs.rs] 19 | features = [] 20 | rustdoc-args = ["--cfg", "docsrs"] 21 | 22 | [dependencies] 23 | tokio-uring = "0.4" -------------------------------------------------------------------------------- /crates/yaws-run-uring/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws-run-uring/README.md -------------------------------------------------------------------------------- /crates/yaws-run-uring/src/lib.rs: -------------------------------------------------------------------------------- 1 | use tokio_uring::net::TcpListener; 2 | 3 | pub fn run() { 4 | tokio_uring::start(async move { 5 | let listener = crate::Listener::new(); 6 | listener.next().await; 7 | }); 8 | } 9 | 10 | struct Listener { 11 | listener: TcpListener, 12 | } 13 | 14 | impl Listener { 15 | fn new() -> Self { 16 | println!("io_uring Listening on 127.0.0.1:9999"); 17 | let listener = TcpListener::bind("127.0.0.1:9999".parse().unwrap()).unwrap(); 18 | 19 | Self { listener } 20 | } 21 | async fn next(self: &Self) { 22 | let (client, addr) = self.listener.accept().await.unwrap(); 23 | 24 | let mut reader = Reader::new(client); 25 | reader = reader.read_next().await; 26 | 27 | //reader.status(); 28 | } 29 | } 30 | 31 | use tokio_uring::buf::IoBufMut; 32 | use tokio_uring::net::TcpStream; 33 | 34 | struct Reader { 35 | buf_in: Vec, 36 | client: TcpStream, 37 | } 38 | 39 | impl Reader { 40 | fn new(client: TcpStream) -> Self { 41 | let buf_in = vec![0; 8192]; 42 | Self { buf_in, client } 43 | } 44 | async fn read_next(mut self) -> Self { 45 | let (res, buf) = self.client.read(self.buf_in).await; 46 | let n = res.unwrap(); 47 | self.buf_in = buf; 48 | 49 | println!("n: {:?}", n); 50 | 51 | self 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /crates/yaws-spec-h1/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws-spec-h1" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server HTTP/1 spec" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [features] 17 | 18 | [package.metadata.docs.rs] 19 | features = [] 20 | rustdoc-args = ["--cfg", "docsrs"] 21 | 22 | [dependencies] 23 | #httparse = "1.7.1" 24 | #logos = "0.12.1" 25 | #nom = "7.1.1" 26 | #thiserror = "1.0.31" 27 | #tokio-uring = "0.4" 28 | 29 | -------------------------------------------------------------------------------- /crates/yaws-spec-h1/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws-spec-h1/README.md -------------------------------------------------------------------------------- /crates/yaws-spec-h1/src/http/client.rs: -------------------------------------------------------------------------------- 1 | use tokio_uring::net::TcpStream; 2 | use tokio_uring::buf::IoBufMut; 3 | 4 | pub struct Reader { 5 | buf_in: Vec, 6 | client: TcpStream, 7 | } 8 | 9 | impl Reader { 10 | pub fn new(client: TcpStream) -> Self { 11 | let buf_in = vec![0; 8192]; 12 | Self { buf_in, client } 13 | } 14 | pub async fn read_next(mut self) -> Self { 15 | let (res, buf) = self.client.read(self.buf_in).await; 16 | let n = res.unwrap(); 17 | self.buf_in = buf; 18 | 19 | println!("n: {:?}", n); 20 | 21 | self 22 | } 23 | /* 24 | pub fn status(&self) { 25 | 26 | // I look dodgy.. 27 | crate::http::parser::status(&self.buf_in) 28 | } 29 | */ 30 | } 31 | -------------------------------------------------------------------------------- /crates/yaws-spec-h1/src/http/parser.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws-spec-h1/src/http/parser.rs -------------------------------------------------------------------------------- /crates/yaws-spec-h1/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub fn add(left: usize, right: usize) -> usize { 2 | left + right 3 | } 4 | 5 | #[cfg(test)] 6 | mod tests { 7 | use super::*; 8 | 9 | #[test] 10 | fn it_works() { 11 | let result = add(2, 2); 12 | assert_eq!(result, 4); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /crates/yaws-spec-h2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws-spec-h2" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server HTTP/1 spec" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [features] 17 | 18 | [package.metadata.docs.rs] 19 | features = [] 20 | rustdoc-args = ["--cfg", "docsrs"] 21 | 22 | [dependencies] 23 | -------------------------------------------------------------------------------- /crates/yaws-spec-h2/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws-spec-h2/README.md -------------------------------------------------------------------------------- /crates/yaws-spec-h2/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub fn add(left: usize, right: usize) -> usize { 2 | left + right 3 | } 4 | 5 | #[cfg(test)] 6 | mod tests { 7 | use super::*; 8 | 9 | #[test] 10 | fn it_works() { 11 | let result = add(2, 2); 12 | assert_eq!(result, 4); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /crates/yaws/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [package.metadata.docs.rs] 17 | features = [] 18 | rustdoc-args = ["--cfg", "docsrs"] 19 | 20 | [dependencies] 21 | 22 | # TODO: gate via yaws-run instead of hacking with package = "x" ? 23 | # Dependency 'yaws-run' has different source paths depending on the build target. 24 | # Each dependency must have a single canonical source path irrespective of build target. 25 | 26 | [target.'cfg(yaws_flavor = "io_uring")'.dependencies] 27 | yaws-run-uring = { path = "../yaws-run-uring", version = "0.0.0-202301.Jan.15" } 28 | 29 | [target.'cfg(yaws_flavor = "lunatic")'.dependencies] 30 | yaws-run-lunatic = { path = "../yaws-run-lunatic", version = "0.0.0-202301.Jan.15" } 31 | lunatic = { version = "0.14" } -------------------------------------------------------------------------------- /crates/yaws/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/crates/yaws/README.md -------------------------------------------------------------------------------- /crates/yaws/src/main.rs: -------------------------------------------------------------------------------- 1 | #[cfg(all(not(yaws_flavor = "io_uring"), not(yaws_flavor = "lunatic")))] 2 | compile_error!("Set cfg(yaws_flavor) either as io_uring or lunatic"); 3 | 4 | #[cfg(yaws_flavor = "io_uring")] 5 | fn main() { 6 | #[cfg(yaws_flavor = "io_uring")] 7 | yaws_run_uring::run(); 8 | } 9 | 10 | #[cfg(yaws_flavor = "lunatic")] 11 | #[lunatic::main] 12 | fn main(mailbox: lunatic::Mailbox<()>) { 13 | yaws_run_lunatic::run(); 14 | 15 | // This will block forever 16 | let _ = mailbox.receive(); 17 | } 18 | -------------------------------------------------------------------------------- /squat/yaws-run/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "yaws-run" 3 | version = "0.0.0-202301.Jan.15" 4 | edition = "2021" 5 | rust-version = "1.60.0" 6 | authors = ["pinkforest"] 7 | description = "Yet Another Web Server" 8 | license = "Apache-2.0/MIT" 9 | readme = "README.md" 10 | homepage = "https://github/yaws-rs/yaws" 11 | repository = "https://github/yaws-rs/yaws" 12 | documentation = "https://docs.rs/yaws" 13 | keywords = ["http"] 14 | categories = ["network-programming", "web-programming::http-server"] 15 | 16 | [features] 17 | 18 | [package.metadata.docs.rs] 19 | features = [] 20 | rustdoc-args = ["--cfg", "docsrs"] 21 | 22 | [dependencies] 23 | -------------------------------------------------------------------------------- /squat/yaws-run/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaws-rs/yaws/1b668af64cac991b65bc34fd0f8b567f0e8ae6ec/squat/yaws-run/README.md -------------------------------------------------------------------------------- /squat/yaws-run/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub fn add(left: usize, right: usize) -> usize { 2 | left + right 3 | } 4 | 5 | #[cfg(test)] 6 | mod tests { 7 | use super::*; 8 | 9 | #[test] 10 | fn it_works() { 11 | let result = add(2, 2); 12 | assert_eq!(result, 4); 13 | } 14 | } 15 | --------------------------------------------------------------------------------