original files from https://code.google.com/p/go/source/browse/?repo=net&r=da30b75b920543618f1549fde1597c6694346c25#hg%2Fwebsocket