Wrong host path parsing

オープン
#265 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
cli, networking

調査の方向性

まず、ローカルサーバーに対する curl コマンドと oha コマンドの違いを再現し、次に、指定された URL から oha が HTTP リクエストターゲットをどのように構築するかを追跡します。リクエストがサーバーの想定するパス形式を使用し、再現したエンドポイントが 404 を返さなくなったことを確認して、修正を検証します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
10.7k
フォーク
311
平均マージ
24分
マージ済み PR(30日)
6

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hatoo/oha のほかの issue

hatoo/oha の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。