Skip to content

Commit aaff527

Browse files
authored
Merge pull request #1 from hhatto/modernize-2025
Modernize 2025
2 parents ae364a3 + 073a1b5 commit aaff527

9 files changed

Lines changed: 1376 additions & 760 deletions

File tree

Cargo.lock

Lines changed: 1018 additions & 406 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
name = "kamasu"
33
version = "0.2.0"
44
authors = ["Hideo Hattori <hhatto.jp@gmail.com>"]
5+
edition = "2021"
56

67
[dependencies]
7-
tokio-core = "0.1"
8-
tokio-io = "0.1"
9-
tokio-tls = "0.1"
10-
native-tls = "0.1"
11-
tls-api = "0.1"
12-
tls-api-openssl = "0.1.9"
13-
futures = "0.1"
14-
httpbis = "0.4.1"
15-
clap = "2"
16-
hyper = { "git" = "https://github.com/hyperium/hyper.git" }
8+
tokio = { version = "1", features = ["full"] }
9+
hyper = { version = "1", features = ["full"] }
10+
hyper-util = { version = "0.1", features = ["full"] }
11+
http-body-util = "0.1"
12+
bytes = "1"
13+
clap = "4"
14+
tokio-rustls = "0.26"
15+
rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
16+
rustls-pki-types = "1"
17+
rcgen = "0.14"

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ HTTP Proxy Sever for PHP Built-in Server, written in Rust.
88
| | +----> | php built-in server | |-+
99
HTTP | +--------+ HTTP | |+---> | (child proc via std::process::Command) | | |
1010
----------->| thread |----------+|+--> | | | |
11-
| | (http) | | || +----------------------------------------+ | |
12-
| +--------- | || +----------------------------------------+ |
13-
| | || +----------------------------------------+
14-
HTTPS | +--------+ HTTP | || :
15-
----------->| thread |-----------+| : N procs
16-
| | (https)| | | :
17-
| +--------+ | |
18-
| | |
19-
HTTP2 | +--------+ HTTP | |
20-
----------->| thread |------------+
21-
| | (http2)| |
11+
| | (http) | | | +----------------------------------------+ | |
12+
| +--------- | | +----------------------------------------+ |
13+
| | | +----------------------------------------+
14+
H2/HTTPS +--------+ HTTP | | :
15+
----------->| thread |-----------+ : N procs
16+
| | (https)| | :
2217
| +--------+ |
18+
| |
2319
+---------------------+
2420
```
2521

@@ -31,8 +27,14 @@ $ cargo install --git https://github.com/hhatto/kamasu.git
3127

3228
## Usage
3329

30+
with HTTP:
3431
```
35-
$ kamasu -S 127.0.0.1:8080 -n 4 -t ./your/docroot -c php.ini
32+
$ kamasu -S 127.0.0.1:8080 -n 4 -t /your/docroot -c php.ini
33+
```
34+
35+
with H2(HTTPS):
36+
```
37+
$ kamasu --https 127.0.0.1:8443 -n 4 -t /your/docroot -c php.ini
3638
```
3739

3840
## License

example/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
header('Content-Type: application/json');
3+
4+
echo json_encode([
5+
'status' => 'ok',
6+
'message' => 'Hello from kamasu!',
7+
'method' => $_SERVER['REQUEST_METHOD'],
8+
'path' => $_SERVER['REQUEST_URI'],
9+
'time' => date('Y-m-d H:i:s'),
10+
'pid' => getmypid(),
11+
]);

example/php.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
; Minimal php.ini for kamasu example
2+
display_errors = On
3+
error_reporting = E_ALL
4+
date.timezone = Asia/Tokyo

src/http2.rs

Lines changed: 0 additions & 114 deletions
This file was deleted.

src/kamasu.p12

-3.29 KB
Binary file not shown.

0 commit comments

Comments
 (0)