Giter Site home page Giter Site logo

go-http's People

Contributors

no-yan avatar

Watchers

 avatar

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 ]

https://datatracker.ietf.org/doc/html/rfc9112#section-2.1

リクエストラインがパースできる

リクエストライン(リクエストの最初のライン)をパースできるようにする。
これにより、メソッド、リクエスト対象、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

フィールドラインがパースできる

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.