This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if trace != nil && trace.WroteHeaders != nil { | |
trace.WroteHeaders() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClientTrace struct { | |
Log(state string) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Request struct { | |
Method string | |
URL *url.URL | |
// ... | |
// Trace callbacks are executed if they are set | |
Trace ClientTrace | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClientTrace struct { | |
// Called before a connection is established. The returned context is used | |
// to finish processing the request. | |
GetConn func(ctx context.Context, hostPort string) context.Context | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClientTrace struct { | |
// Called before a connection is established. If it returns a | |
// non nil object, that object is used instead for the Connection. | |
GetConn func(hostPort string) *net.Conn | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClientTrace struct { | |
// GetConn is called before a connection is created or | |
// retrieved from an idle pool. The hostPort is the | |
// "host:port" of the target or proxy. GetConn is called even | |
// if there's already an idle cached connection available. | |
GetConn func(hostPort string) | |
// GotConn is called after a successful connection is | |
// obtained. There is no hook for failure to obtain a | |
// connection; instead, use the error from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"net/http/httptest" | |
"net/http/httptrace" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package goexperiments | |
import ( | |
"context" | |
"net/http" | |
) | |
type HandlerMiddleware interface { | |
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package goexperiments | |
import ( | |
"context" | |
"net/http" | |
) | |
type HandlerMiddleware interface { | |
HandleHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request, next http.Handler) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
import "golang.org/x/net/context" | |
// A message processes parameter and returns the result on responseChan. | |
// ctx is places in a struct, but this is ok to do. | |
type message struct { | |
responseChan chan<- int | |
parameter string |