Skip to content

Instantly share code, notes, and snippets.

@kidoman kidoman/gaesocket.go
Created Sep 23, 2014

What would you like to do?
Whats wrong with this?
package web
import (
func init() {
http.HandleFunc("/", handler)
func handler(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
transport := &http.Transport{
Dial: func(network, addr string) (net.Conn, error) {
c.Infof("connecting socket to %v/%v", network, addr)
conn, err := socket.Dial(c, network, addr)
c.Infof("connected socket to %v/%v", network, addr)
return conn, err
client := &http.Client{
Transport: transport,
resp, err := client.Get("")
if err != nil {
defer resp.Body.Close()
io.Copy(w, resp.Body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.