1
// Copyright 2011 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
12
register(httpHeadersFix)
15
var httpHeadersFix = fix{
19
`Rename http Referer, UserAgent, Cookie, SetCookie, which are now methods.
21
http://codereview.appspot.com/4620049/
25
func httpheaders(f *ast.File) bool {
26
if !imports(f, "http") {
30
called := make(map[ast.Node]bool)
31
walk(f, func(ni interface{}) {
32
switch n := ni.(type) {
39
typeof, _ := typecheck(headerTypeConfig, f)
40
walk(f, func(ni interface{}) {
41
switch n := ni.(type) {
42
case *ast.SelectorExpr:
46
if t := typeof[n.X]; t != "*http.Request" && t != "*http.Response" {
50
case "Referer", "UserAgent":
54
n.Sel.Name = "Cookies()"
62
var headerTypeConfig = &TypeConfig{
63
Type: map[string]*Type{