go-http's People
go-http's Issues
フィールドラインがパースできる
フィールドライン(ヘッダー)をパースし、Request構造体に追加する
- field の持ち方はマップにする
- フィールド名は net/http の実装を参考にする
- 先頭とハイフンの次の文字が大文字、それ以外が小文字
// HTTP defines that header names are case-insensitive. The
// request parser implements this by using CanonicalHeaderKey,
// making the first character and any characters following a
// hyphen uppercase and the rest lowercase.
Goでリクエストをパースできる
リクエストライン #3、フィールドライン #4、メッセージボディー #5 のパースが必要になる。
フィールドとボディーの区切りは空行で示される。また、bodyは省略可能。
An HTTP/1.1 message consists of a start-line followed by a CRLF and a sequence of octets in a format similar to the Internet Message Format [RFC5322]: zero or more header field lines (collectively referred to as the "headers" or the "header section"), an empty line indicating the end of the header section, and an optional message body.
HTTP-message = start-line CRLF
*( field-line CRLF )
CRLF
[ message-body ]
リクエストラインがパースできる
リクエストライン(リクエストの最初のライン)をパースできるようにする。
これにより、メソッド、リクエスト対象、HTTP-versionがわかるようになる。
A request-line begins with a method token, followed by a single space (SP), the request-target, and another single space (SP), and ends with the protocol version.
request-line = method SP request-target SP HTTP-version
https://datatracker.ietf.org/doc/html/rfc9112#name-request-line
レスポンスが作成できる
HTTP-message = start-line CRLF
*( field-line CRLF )
CRLF
[ message-body ]
#6 が必要
リクエストのメッセージボディーがパースできる
リクエストを受け、レスポンスを返す簡単なサーバーをかく
Response構造体をどう持つか一旦保留したかったので、雑にWriteでResponseを書くことにした
フィールドラインがパースできる
https://datatracker.ietf.org/doc/html/rfc9112#name-field-syntax
フィールドライン(ヘッダー)をパースし、Request構造体に追加する
- field の持ち方はマップにする
- フィールド名は net/http の実装を参考にする
- 先頭とハイフンの次の文字が大文字、それ以外が小文字
// HTTP defines that header names are case-insensitive. The
// request parser implements this by using CanonicalHeaderKey,
// making the first character and any characters following a
// hyphen uppercase and the rest lowercase.
レスポンスのステータスラインを作成できる
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.