X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonstat.git;a=blobdiff_plain;f=xonstat%2Futil%2Fxs_interceptor%2Fxs_interceptor.go;h=abffb8709089b6bd8cc7a8423cee6a7dfa897244;hp=88eda745149e13aba8ffc9a4d9865f9eef53d979;hb=7903e1a259defb83c7b15e03a9c020893deccb74;hpb=c0292c263c497806f4922ca5fa894f5fa2b14e08 diff --git a/xonstat/util/xs_interceptor/xs_interceptor.go b/xonstat/util/xs_interceptor/xs_interceptor.go index 88eda74..abffb87 100644 --- a/xonstat/util/xs_interceptor/xs_interceptor.go +++ b/xonstat/util/xs_interceptor/xs_interceptor.go @@ -7,6 +7,7 @@ import "html/template" import "net/http" import "os" import "strings" +import "time" import _ "github.com/mattn/go-sqlite3" // HTML templates @@ -115,7 +116,13 @@ func serve(port int) { // serving fmt.Printf("Serving on port %d...\n", port) addr := fmt.Sprintf(":%d", port) - http.ListenAndServe(addr, nil) + for true { + err := http.ListenAndServe(addr, nil) + if err == nil { + fmt.Println("got it!") + } + time.Sleep(100*time.Millisecond) + } } // intercepts all URLs, displays a landing page @@ -211,7 +218,9 @@ func resubmit(url string) { } req, _ := http.NewRequest("POST", url, strings.NewReader(body)) - req.ContentLength = int64(bodylength) + //req.ContentLength = int64(bodylength) + //req.ContentLength = 0 + req.ContentLength = int64(len([]byte(body))) header := map[string][]string{ "X-D0-Blind-Id-Detached-Signature": {blind_id_header}, @@ -222,6 +231,7 @@ func resubmit(url string) { res, err := http.DefaultClient.Do(req) if err != nil { fmt.Printf("Error submitting request #%d. Continuing...\n", request_id) + fmt.Println(err) continue } defer res.Body.Close()