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

Side by Side Diff: src/pkg/http/transfer.go

Issue 2261042: http: Support HTTP/1.0 Keep-Alive (Closed)
Patch Set: code review 2261042: http: Support HTTP/1.0 Keep-Alive Created 14 years, 5 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/http/server.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package http 5 package http
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "io" 9 "io"
10 "os" 10 "os"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 if strings.Index(strings.ToLower(header["Content-Type"]), "multipart/byt eranges") >= 0 { 345 if strings.Index(strings.ToLower(header["Content-Type"]), "multipart/byt eranges") >= 0 {
346 return -1, ErrNotSupported 346 return -1, ErrNotSupported
347 } 347 }
348 348
349 // Body-EOF logic based on other methods (like closing, or chunked codin g) 349 // Body-EOF logic based on other methods (like closing, or chunked codin g)
350 return -1, nil 350 return -1, nil
351 } 351 }
352 352
353 // Determine whether to hang up after sending a request and body, or 353 // Determine whether to hang up after sending a request and body, or
354 // receiving a response and body 354 // receiving a response and body
355 // 'header' is the request headers
355 func shouldClose(major, minor int, header map[string]string) bool { 356 func shouldClose(major, minor int, header map[string]string) bool {
356 » if major < 1 || (major == 1 && minor < 1) { 357 » if major < 1 {
357 return true 358 return true
359 } else if major == 1 && minor == 0 {
360 v, present := header["Connection"]
361 if !present {
362 return true
363 }
364 v = strings.ToLower(v)
365 if strings.Index(v, "keep-alive") == -1 {
366 return true
367 }
368 return false
358 } else if v, present := header["Connection"]; present { 369 } else if v, present := header["Connection"]; present {
359 // TODO: Should split on commas, toss surrounding white space, 370 // TODO: Should split on commas, toss surrounding white space,
360 // and check each field. 371 // and check each field.
361 if v == "close" { 372 if v == "close" {
362 header["Connection"] = "", false 373 header["Connection"] = "", false
363 return true 374 return true
364 } 375 }
365 } 376 }
366 return false 377 return false
367 } 378 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return err 434 return err
424 } 435 }
425 if b.hdr == nil { // not reading trailer 436 if b.hdr == nil { // not reading trailer
426 return nil 437 return nil
427 } 438 }
428 439
429 // TODO(petar): Put trailer reader code here 440 // TODO(petar): Put trailer reader code here
430 441
431 return nil 442 return nil
432 } 443 }
OLDNEW
« no previous file with comments | « src/pkg/http/server.go ('k') | no next file » | no next file with comments »

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