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.
11
var httpHeadersFix = fix{
14
`Rename http Referer, UserAgent, Cookie, SetCookie, which are now methods.
16
http://codereview.appspot.com/4620049/
21
register(httpHeadersFix)
24
func httpheaders(f *ast.File) bool {
25
if !imports(f, "http") {
29
called := make(map[ast.Node]bool)
30
walk(f, func(ni interface{}) {
31
switch n := ni.(type) {
38
typeof := typecheck(headerTypeConfig, f)
39
walk(f, func(ni interface{}) {
40
switch n := ni.(type) {
41
case *ast.SelectorExpr:
45
if t := typeof[n.X]; t != "*http.Request" && t != "*http.Response" {
49
case "Referer", "UserAgent":
53
n.Sel.Name = "Cookies()"
61
var headerTypeConfig = &TypeConfig{
62
Type: map[string]*Type{
63
"*http.Request": &Type{},
64
"*http.Response": &Type{},