"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/test/echo/server/forwarder/http.go" between
istio-1.10.0.tar.gz and istio-1.10.1.tar.gz

About: Istio is a platform-independent service mesh that provides a uniform way to connect, secure, control, and observe microservices.

http.go  (istio-1.10.0):http.go  (istio-1.10.1)
skipping to change at line 40 skipping to change at line 40
"istio.io/istio/pkg/test/echo/common/response" "istio.io/istio/pkg/test/echo/common/response"
) )
var _ protocol = &httpProtocol{} var _ protocol = &httpProtocol{}
type httpProtocol struct { type httpProtocol struct {
client *http.Client client *http.Client
do common.HTTPDoFunc do common.HTTPDoFunc
} }
func splitPath(raw string) (url, path string) {
schemeSep := "://"
schemeBegin := strings.Index(raw, schemeSep)
if schemeBegin == -1 {
return raw, ""
}
schemeEnd := schemeBegin + len(schemeSep)
pathBegin := strings.IndexByte(raw[schemeEnd:], '/')
if pathBegin == -1 {
return raw, ""
}
return raw[:schemeEnd+pathBegin], raw[schemeEnd+pathBegin:]
}
func (c *httpProtocol) setHost(r *http.Request, host string) { func (c *httpProtocol) setHost(r *http.Request, host string) {
r.Host = host r.Host = host
if r.URL.Scheme == "https" { if r.URL.Scheme == "https" {
// Set SNI value to be same as the request Host // Set SNI value to be same as the request Host
// For use with SNI routing tests // For use with SNI routing tests
httpTransport, ok := c.client.Transport.(*http.Transport) httpTransport, ok := c.client.Transport.(*http.Transport)
if ok && httpTransport.TLSClientConfig.ServerName == "" { if ok && httpTransport.TLSClientConfig.ServerName == "" {
httpTransport.TLSClientConfig.ServerName = host httpTransport.TLSClientConfig.ServerName = host
return return
skipping to change at line 71 skipping to change at line 85
return return
} }
} }
} }
func (c *httpProtocol) makeRequest(ctx context.Context, req *request) (string, e rror) { func (c *httpProtocol) makeRequest(ctx context.Context, req *request) (string, e rror) {
method := req.Method method := req.Method
if method == "" { if method == "" {
method = "GET" method = "GET"
} }
httpReq, err := http.NewRequest(method, req.URL, nil)
// Manually split the path from the URL, the http.NewRequest() will fail
to parse paths with invalid encoding that we
// intentionally used in the test.
u, p := splitPath(req.URL)
httpReq, err := http.NewRequest(method, u, nil)
if err != nil { if err != nil {
return "", err return "", err
} }
// Use raw path, we don't want golang normalizing anything since we use t his for testing purposes // Use raw path, we don't want golang normalizing anything since we use t his for testing purposes
httpReq.URL.Opaque = httpReq.URL.RawPath httpReq.URL.Opaque = p
// Set the per-request timeout. // Set the per-request timeout.
ctx, cancel := context.WithTimeout(ctx, req.Timeout) ctx, cancel := context.WithTimeout(ctx, req.Timeout)
defer cancel() defer cancel()
httpReq = httpReq.WithContext(ctx) httpReq = httpReq.WithContext(ctx)
var outBuffer bytes.Buffer var outBuffer bytes.Buffer
outBuffer.WriteString(fmt.Sprintf("[%d] Url=%s\n", req.RequestID, req.URL )) outBuffer.WriteString(fmt.Sprintf("[%d] Url=%s\n", req.RequestID, req.URL ))
host := "" host := ""
writeHeaders(req.RequestID, req.Header, outBuffer, func(key string, value string) { writeHeaders(req.RequestID, req.Header, outBuffer, func(key string, value string) {
 End of changes. 3 change blocks. 
2 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)