From ef5f24bd1f25151f993079d2b4407d9a18666e14 Mon Sep 17 00:00:00 2001
From: jbhusson <jonah@elixxir.io>
Date: Fri, 6 Jan 2023 12:19:10 -0500
Subject: [PATCH] revert to http, remove trace wrapper

---
 connect/comms.go   |  4 ++--
 connect/webConn.go | 20 +++-----------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/connect/comms.go b/connect/comms.go
index 5b88281..f9e518d 100644
--- a/connect/comms.go
+++ b/connect/comms.go
@@ -317,7 +317,7 @@ func (c *ProtoComms) ServeWithWeb() {
 		jww.WARN.Printf("Starting HTTP server!")
 
 		c.httpServer = &http.Server{
-			Handler: &httpTraceWrapper{ws: httpServer},
+			Handler: httpServer,
 		}
 
 		if err := c.httpServer.Serve(l); err != nil {
@@ -515,7 +515,7 @@ func (c *ProtoComms) ServeHttps(keyPair tls.Certificate) error {
 		jww.WARN.Printf("Starting HTTPS server!")
 
 		c.httpsServer = &http.Server{
-			Handler: &httpTraceWrapper{ws: httpsServer},
+			Handler: httpsServer,
 		}
 
 		if err := c.httpsServer.Serve(tlsLis); err != nil {
diff --git a/connect/webConn.go b/connect/webConn.go
index 0d87f8d..ec208f8 100644
--- a/connect/webConn.go
+++ b/connect/webConn.go
@@ -3,9 +3,7 @@ package connect
 import (
 	"crypto/tls"
 	"crypto/x509"
-	"fmt"
 	"golang.org/x/net/http2"
-	"io"
 	"net/http"
 	"net/http/httptrace"
 	"regexp"
@@ -214,8 +212,8 @@ func (wc *webConn) isOnlineHelper(addr string, pingTimeout time.Duration) (time.
 		Transport: tr,
 		Timeout:   pingTimeout,
 	}
-	target := "https://" + addr + "/*"
-	req, err := http.NewRequest(http.MethodTrace, target, nil)
+	target := "http://" + addr + ""
+	req, err := http.NewRequest(http.MethodGet, target, nil)
 	if err != nil {
 		jww.WARN.Printf("Failed to initiate request: %+v", err)
 		return time.Since(start), false
@@ -236,31 +234,19 @@ func (wc *webConn) isOnlineHelper(addr string, pingTimeout time.Duration) (time.
 	// IMPORTANT - enables better HTTP(S) discovery, because many browsers block CORS by default.
 	req.Header = wc.addHeaders(req.Header)
 	jww.TRACE.Printf("(GO request): %+v", req)
-	//ctx, cancel := context.WithTimeout(req.Context(), 5*time.Second)
 	req = req.WithContext(httptrace.WithClientTrace(req.Context(), trace))
-	var resp *http.Response
-	if resp, err = client.Do(req); err != nil {
+	if _, err = client.Do(req); err != nil {
 		jww.TRACE.Printf("(GO error): %s", err.Error())
-		fmt.Println(err)
 		if checkErrorExceptions(err) {
-			fmt.Println(1)
 			jww.DEBUG.Printf(
 				"Web connectivity verified for address %s with error %+v",
 				addr, err)
 		} else {
-			fmt.Println(2)
 			jww.WARN.Printf(
 				"Failed to verify connectivity for address %s: %+v", addr, err)
-			//cancel()
 			return time.Since(start), false
 		}
 	}
-	//cancel()
-	if resp != nil {
-		fmt.Println(resp)
-		respBody, _ := io.ReadAll(resp.Body)
-		fmt.Println(string(respBody))
-	}
 	client.CloseIdleConnections()
 	return time.Since(start), true
 }
-- 
GitLab