Skip to content

Commit

Permalink
更新readme
Browse files Browse the repository at this point in the history
  • Loading branch information
guonaihong committed Jun 12, 2024
1 parent 833262c commit 64586b7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,34 @@
"Cache-Control: max-age=0\r\n\r\nb\r\nhello world\r\n0\r\n\r\n")

var setting = httparser.Setting{
MessageBegin: func(*httparser.Parser) {
MessageBegin: func(*httparser.Parser, int) {
//解析器开始工作
fmt.Printf("begin\n")
},
URL: func(_ *httparser.Parser, buf []byte) {
URL: func(_ *httparser.Parser, buf []byte, _ int) {
//url数据
fmt.Printf("url->%s\n", buf)
},
Status: func(*httparser.Parser, []byte) {
Status: func(*httparser.Parser, []byte, _ int) {
// 响应包才需要用到
},
HeaderField: func(_ *httparser.Parser, buf []byte) {
HeaderField: func(_ *httparser.Parser, buf []byte, _ int) {
// http header field
fmt.Printf("header field:%s\n", buf)
},
HeaderValue: func(_ *httparser.Parser, buf []byte) {
HeaderValue: func(_ *httparser.Parser, buf []byte, _ int) {
// http header value
fmt.Printf("header value:%s\n", buf)
},
HeadersComplete: func(_ *httparser.Parser) {
HeadersComplete: func(_ *httparser.Parser, _ int) {
// http header解析结束
fmt.Printf("header complete\n")
},
Body: func(_ *httparser.Parser, buf []byte) {
Body: func(_ *httparser.Parser, buf []byte, _ int) {
fmt.Printf("%s", buf)
// Content-Length 或者chunked数据包
},
MessageComplete: func(_ *httparser.Parser) {
MessageComplete: func(_ *httparser.Parser, _ int) {
// 消息解析结束
fmt.Printf("\n")
},
Expand Down

0 comments on commit 64586b7

Please sign in to comment.