haskell / haskell/HTTP

receiveHTTP does not preprocess the incoming URI before it is parsed

オープン
#76 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Haskell
スター
186
フォーク
59
PR マージ指標
30日以内にマージされた PR はありません

説明

Because of the strict parsing of URIs by Network.URI.parseURIReference, parseRequestHead fails on this "almost valid" URI:

```
ghci> parseRequestHead ["GET http://fonts.googleapis.com/css?family=Roboto:300|Open+Sans:700|Open+Sans:300&lang=en HTTP/1.1"]
ghci> Left (ErrorParse "parseRequestHead Request command line parse failure: GET http://fonts.googleapis.com/css?family=Roboto:300|Open+Sans:700|Open+Sans:300&lang=en HTTP/1.1")
```

Replacing the pipe characters with %7C allows the URI to parse.

receiveHTTP, or maybe parseRequestHead, should probably try to escape the characters that are considered invalid for URIs, before sending the string through parseURIReference.

In that regard, `escapeURIString isAllowedInURI` from Network.URI may be handy.

(Something about "be conservative in what you send, be liberal in what you accept" prompted me to raise this issue.)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず receiveHTTP と parseRequestHead を読み、次に受信したリクエスト URI がどのように Network.URI.parseURIReference に到達するかを調べます。無効な URI 文字に対する、提案されている escapeURIString isAllowedInURI の動作を確認し、issue で示されている両方のエントリポイントを検討します。表示された URI が受け入れられ、すでに有効な URI も引き続き正しくパースされれば完了です。

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

評価

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

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

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