diff --git a/pprofweb/page.go b/pprofweb/page.go
index 0eb7b16..8944c79 100644
--- a/pprofweb/page.go
+++ b/pprofweb/page.go
@@ -9,11 +9,13 @@ const rootTemplate = `
PProf Web Interface
-Upload a file to explore it using the Pprof web interface.
-
-the source code over here .
+
Upload a file to explore it using the Pprof web interface.
+
+the source code over here .
+
+
code is based off this project.
@@ -42,6 +44,15 @@ works with whatever works in the command line (it just runs go tool pprof in the
+
+
+
+
+u can also use curl! basically it checks if your Accept headers have "http", and if not, then it will not redirect, and will send the id instead
+curl -F file=@ https://pprof.aaaaa.news/upload
+
+
+
`
diff --git a/pprofweb/pprofweb.go b/pprofweb/pprofweb.go
index 0c96187..bbd9db8 100644
--- a/pprofweb/pprofweb.go
+++ b/pprofweb/pprofweb.go
@@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path"
+ "strings"
"sync"
"time"
@@ -168,7 +169,13 @@ func (s *Server) handleUpload(w http.ResponseWriter, r *http.Request) error {
if err != nil {
return err
}
- http.Redirect(w, r, instance.id.String()+"/", http.StatusSeeOther)
+ for _, h := range r.Header.Values("Accept") {
+ if strings.Contains(h, "text/html") {
+ http.Redirect(w, r, instance.id.String()+"/", http.StatusSeeOther)
+ return nil
+ }
+ }
+ w.Write([]byte(instance.id.String()))
return nil
}
@@ -176,7 +183,6 @@ type Instance struct {
id xid.ID
dat []byte
- setup sync.Once
handler http.Handler
mu sync.RWMutex
@@ -204,7 +210,6 @@ func (i *Instance) startHTTP(args *driver.HTTPServerArgs) error {
r := chi.NewRouter()
for pattern, handler := range args.Handlers {
jpat := "/" + path.Join(i.id.String(), pattern)
- log.Println(jpat)
r.Handle(jpat, handler)
r.Handle(jpat+"/", handler)
}