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

Delta Between Two Patch Sets: src/pkg/net/http/fcgi/child.go

Issue 5449070: code review 5449070: net: shorten composite literal field values (Closed)
Left Patch Set: Created 12 years, 4 months ago
Right Patch Set: diff -r f91f50b96e10 https://go.googlecode.com/hg/ Created 12 years, 4 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
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 fcgi 5 package fcgi
6 6
7 // This file implements FastCGI from the perspective of a child process. 7 // This file implements FastCGI from the perspective of a child process.
8 8
9 import ( 9 import (
10 "errors" 10 "errors"
(...skipping 13 matching lines...) Expand all
24 reqId uint16 24 reqId uint16
25 params map[string]string 25 params map[string]string
26 buf [1024]byte 26 buf [1024]byte
27 rawParams []byte 27 rawParams []byte
28 keepConn bool 28 keepConn bool
29 } 29 }
30 30
31 func newRequest(reqId uint16, flags uint8) *request { 31 func newRequest(reqId uint16, flags uint8) *request {
32 r := &request{ 32 r := &request{
33 reqId: reqId, 33 reqId: reqId,
34 » » params: map[string]string{}, 34 » » params: {},
gri 2011/12/02 23:06:26 I'd leave this file alone - no real win
35 keepConn: flags&flagKeepConn != 0, 35 keepConn: flags&flagKeepConn != 0,
36 } 36 }
37 r.rawParams = r.buf[:0] 37 r.rawParams = r.buf[:0]
38 return r 38 return r
39 } 39 }
40 40
41 // parseParams reads an encoded []byte into Params. 41 // parseParams reads an encoded []byte into Params.
42 func (r *request) parseParams() { 42 func (r *request) parseParams() {
43 text := r.rawParams 43 text := r.rawParams
44 r.rawParams = nil 44 r.rawParams = nil
(...skipping 20 matching lines...) Expand all
65 type response struct { 65 type response struct {
66 req *request 66 req *request
67 header http.Header 67 header http.Header
68 w *bufWriter 68 w *bufWriter
69 wroteHeader bool 69 wroteHeader bool
70 } 70 }
71 71
72 func newResponse(c *child, req *request) *response { 72 func newResponse(c *child, req *request) *response {
73 return &response{ 73 return &response{
74 req: req, 74 req: req,
75 » » header: http.Header{}, 75 » » header: {},
76 w: newWriter(c.conn, typeStdout, req.reqId), 76 w: newWriter(c.conn, typeStdout, req.reqId),
77 } 77 }
78 } 78 }
79 79
80 func (r *response) Header() http.Header { 80 func (r *response) Header() http.Header {
81 return r.header 81 return r.header
82 } 82 }
83 83
84 func (r *response) Write(data []byte) (int, error) { 84 func (r *response) Write(data []byte) (int, error) {
85 if !r.wroteHeader { 85 if !r.wroteHeader {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 for { 262 for {
263 rw, err := l.Accept() 263 rw, err := l.Accept()
264 if err != nil { 264 if err != nil {
265 return err 265 return err
266 } 266 }
267 c := newChild(rw, handler) 267 c := newChild(rw, handler)
268 go c.serve() 268 go c.serve()
269 } 269 }
270 panic("unreachable") 270 panic("unreachable")
271 } 271 }
LEFTRIGHT

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