Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Delta Between Two Patch Sets: src/pkg/http/request.go

Issue 4634112: code review 4634112: http: make NewChunkedReader public (Closed)
Left Patch Set: Created 13 years, 8 months ago
Right Patch Set: diff -r e93aca7ce587 https://go.googlecode.com/hg/ Created 13 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/http/chunked.go ('k') | src/pkg/http/transfer.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // HTTP Request reading and parsing. 5 // HTTP Request reading and parsing.
6 6
7 // Package http implements parsing of HTTP requests, replies, and URLs and 7 // Package http implements parsing of HTTP requests, replies, and URLs and
8 // provides an extensible HTTP server and a basic HTTP client. 8 // provides an extensible HTTP server and a basic HTTP client.
9 package http 9 package http
10 10
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if !ok || i != len(vers) { 419 if !ok || i != len(vers) {
420 return 0, 0, false 420 return 0, 0, false
421 } 421 }
422 return major, minor, true 422 return major, minor, true
423 } 423 }
424 424
425 type chunkedReader struct { 425 type chunkedReader struct {
426 r *bufio.Reader 426 r *bufio.Reader
427 n uint64 // unread bytes in chunk 427 n uint64 // unread bytes in chunk
428 err os.Error 428 err os.Error
429 }
430
431 func newChunkedReader(r *bufio.Reader) *chunkedReader {
432 return &chunkedReader{r: r}
433 } 429 }
434 430
435 func (cr *chunkedReader) beginChunk() { 431 func (cr *chunkedReader) beginChunk() {
436 // chunk-size CRLF 432 // chunk-size CRLF
437 var line string 433 var line string
438 line, cr.err = readLine(cr.r) 434 line, cr.err = readLine(cr.r)
439 if cr.err != nil { 435 if cr.err != nil {
440 return 436 return
441 } 437 }
442 cr.n, cr.err = strconv.Btoui64(line, 16) 438 cr.n, cr.err = strconv.Btoui64(line, 16)
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 func (r *Request) expectsContinue() bool { 800 func (r *Request) expectsContinue() bool {
805 return strings.ToLower(r.Header.Get("Expect")) == "100-continue" 801 return strings.ToLower(r.Header.Get("Expect")) == "100-continue"
806 } 802 }
807 803
808 func (r *Request) wantsHttp10KeepAlive() bool { 804 func (r *Request) wantsHttp10KeepAlive() bool {
809 if r.ProtoMajor != 1 || r.ProtoMinor != 0 { 805 if r.ProtoMajor != 1 || r.ProtoMinor != 0 {
810 return false 806 return false
811 } 807 }
812 return strings.Contains(strings.ToLower(r.Header.Get("Connection")), "ke ep-alive") 808 return strings.Contains(strings.ToLower(r.Header.Get("Connection")), "ke ep-alive")
813 } 809 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b