hatoo / hatoo/oha

Wrong host path parsing

Open
#265 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
10.5k
Forks
298
Avg merge
4h 20m
Merged PRs (30d)
5

Description

I've just encountered an unexpected behavior. My tests fail with 404 response whenever I try to target an url containing port like: `http://localhost:XXXX/some_path`.
Curl request: `curl -XGET 'http://localhost:8080/api/v1/health'` results in following output:
```
2023-10-11 23:10:30 127.0.0.1:56008 GET /api/v1/health HTTP/1.1
┌─Incoming request
│ GET /api/v1/health HTTP/1.1
│ Accept: */*
│ Host: localhost:8080
│ User-Agent: curl/8.1.2
┌─Outgoing response
│ HTTP/1.1 200 OK
│ Content-Length: 9
│ Content-Type: text/plain; charset=utf-8
│ Date: Tue, 11 Jul 2023 23:10:30 +0200
```
When using oha with: `oha -n 1 'http://localhost:8080/api/v1/health'` i get following response:
```
2023-11-11 23:11:21 127.0.0.1:58418 GET http://localhost:8080/api/v1/health HTTP/1.1
┌─Incoming request
│ GET http://localhost:8080/api/v1/health HTTP/1.1
│ Accept: */*
│ Accept-Encoding: gzip, compress, deflate, br
│ Host: localhost:8080
┌─Outgoing response
│ HTTP/1.1 200 OK
│ Content-Length: 9
│ Content-Type: text/plain; charset=utf-8
│ Date: Tue, 11 Jul 2023 23:11:21 +0200
```

As you can see, the path in case of oha-request contains domain and port, which is incorrect and will result in 404 response.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.