Skip to content

Commit 35e829e

Browse files
author
Krish
committed
change ports
1 parent 420b348 commit 35e829e

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ cmake --build aws-c-http/build --target install
5656

5757
To run some of the integration tests (start with localhost_integ_*), you need to set up a localhost that echo the request headers from `/echo` back first.
5858

59-
To do that, check [localhost](./tests/py_localhost/) script we have.
59+
To do that, check [localhost](./tests/mock_server/) script we have.
6060

6161
After that, configure and build your cmake project with `-DENABLE_LOCALHOST_INTEGRATION_TESTS=true` to build the tests with localhost and run them from `ctest --output-on-failure -R localhost_integ_*`.

bin/h2benchmark/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ this is a C program mimic the API call benchmark from aws-java-sdk-v2. https://g
44

55
It collects how many API calls finish per second. Basically how many request can made per second.
66

7-
The program connects to the local host that can be found [here](../../tests/py_localhost).
7+
The program connects to the local host that can be found [here](../../tests/mock_server).
88

99
To run the benchmark, build the h2benchmark with aws-c-http as dependency.
1010
TODO: Currently the configs are all hardcoded.

tests/mock_server/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,18 @@ pip3 install trio h11
100100

101101
### Basic Usage (HTTP + HTTPS)
102102

103-
Run both HTTP (port 80) and HTTPS (port 443) servers:
103+
Run both HTTP (port 8081) and HTTPS (port 8082) servers:
104104

105105
```bash
106-
sudo python3 mock_server.py
106+
python3 mock_server.py
107107
```
108108

109-
Note: `sudo` is required for ports 80 and 443 on most systems.
110-
111-
### Test Mode (Custom Port)
109+
### Custom Ports
112110

113111
Run on a custom port without sudo:
114112

115113
```bash
116-
TEST_PORT=8080 python3 mock_server.py
114+
HTTP_PORT=8080 HTTPS_PORT=8443 python3 mock_server.py
117115
```
118116

119117
**Important**: Since this uses a self-signed certificate, clients must disable peer verification.

tests/mock_server/h11mock_server.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,12 @@ async def serve_ssl(port, cert_file=os.path.join(os.path.dirname(__file__),
247247

248248

249249
async def main():
250-
test_port = os.environ.get('TEST_PORT')
250+
http_port = os.environ.get('HTTP_PORT')
251+
https_port = os.environ.get('HTTPS_PORT')
251252

252-
if test_port:
253-
print(f"Running in test mode on port {test_port}")
254-
await serve(int(test_port))
255-
else:
256-
async with trio.open_nursery() as nursery:
257-
nursery.start_soon(serve, 80)
258-
nursery.start_soon(serve_ssl, 443)
253+
async with trio.open_nursery() as nursery:
254+
nursery.start_soon(serve, 8081 if not http_port else int(http_port))
255+
nursery.start_soon(serve_ssl, 8082 if not https_port else int(https_port))
259256

260257

261258
if __name__ == "__main__":

0 commit comments

Comments
 (0)