diff options
| author | Jeff Carr <[email protected]> | 2025-09-06 15:36:36 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-06 16:04:51 -0500 |
| commit | 0d1f53afee67293e930d9f67bd71442c154d196a (patch) | |
| tree | 6d7d559e27aea94c1b746be9d3e3f4965bebc598 /http.go | |
| parent | d795dbeb610a8b0aa315e39175f574dd5ee0cc4e (diff) | |
all kindsa crazy. this needs massive cleanup
Diffstat (limited to 'http.go')
| -rw-r--r-- | http.go | 29 |
1 files changed, 11 insertions, 18 deletions
@@ -49,11 +49,10 @@ func whoSent(r *http.Request) string { } func okHandler(w http.ResponseWriter, r *http.Request) { + // something appears to be buggy. always get this first I guess msg, err := ioutil.ReadAll(r.Body) // Read the body as []byte - if err != nil { - log.Info("ioutil.ReadAll() error =", err) - return - } + r.Body.Close() + log.Info("TRYING TO MARSHAL bytes:", len(msg), err) who := whoSent(r) @@ -76,7 +75,12 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - log.Warn("forged REQUEST URL =", requrl, "msg =", len(msg), "from =", who) + log.Warn("forged REQUEST URL =", requrl, "from =", who) + + if strings.HasPrefix(route, "/patches/") { + handlePatches(w, r, msg) + return + } if route == "/patchset" { if err := savePatchset(w, msg); err != nil { @@ -119,15 +123,9 @@ func okHandler(w http.ResponseWriter, r *http.Request) { } if route == "/GetPatchsets" { - data, err := me.forge.Patchsets.Marshal() - if err != nil { - log.Info("patchsets.Marshal() to wire failed", err) - return - } - start := time.Now() - log.Info("going to w.Write(data) with len", len(data)) - w.Write(data) + log.Info("going to w.Write(msg) with len", len(msg)) + w.Write(msg) age := shell.FormatDuration(time.Since(start)) log.Printf("Done with xfer in (%s). happy hacking!\n", age) return @@ -139,11 +137,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } - if strings.HasPrefix(route, "/patches/") { - handlePatches(w, r) - return - } - if route == "/goReference.svg" { w.Header().Set("Content-Type", "image/svg+xml") writeFile(w, "goReference.svg") |
