summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-06 15:36:36 -0500
committerJeff Carr <[email protected]>2025-09-06 16:04:51 -0500
commit0d1f53afee67293e930d9f67bd71442c154d196a (patch)
tree6d7d559e27aea94c1b746be9d3e3f4965bebc598 /http.go
parentd795dbeb610a8b0aa315e39175f574dd5ee0cc4e (diff)
all kindsa crazy. this needs massive cleanup
Diffstat (limited to 'http.go')
-rw-r--r--http.go29
1 files changed, 11 insertions, 18 deletions
diff --git a/http.go b/http.go
index 4d9a5d6..5d844e1 100644
--- a/http.go
+++ b/http.go
@@ -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")