Skip to content

invalid WriteHeader code 0 #54

@girino

Description

@girino

haven/init.go

Line 418 in 8cd76b1

return true, "only notes signed by the owner of this relay are allowed", 0

RejectUpload in init.go is returning code 0, but khatru/blossom expects a valid http return code.

haven-relay | 2024/11/15 02:49:41 http: panic serving 192.168.41.152:34650: invalid WriteHeader code 0
haven-relay | goroutine 4958 [running]:
haven-relay | net/http.(*conn).serve.func1()
haven-relay | /usr/local/go/src/net/http/server.go:1947 +0xbe
haven-relay | panic({0x1130ce0?, 0xc0006991a0?})
haven-relay | /usr/local/go/src/runtime/panic.go:785 +0x132
haven-relay | net/http.checkWriteHeaderCode(...)
haven-relay | /usr/local/go/src/net/http/server.go:1170
haven-relay | net/http.(*response).WriteHeader(0xc000714380, 0x0)
haven-relay | /usr/local/go/src/net/http/server.go:1204 +0x879
haven-relay | github.com/fiatjaf/khatru/blossom.blossomError({0x15d5b70, 0xc000714380}, {0x13970c5, 0x38}, 0x0)
haven-relay | /go/pkg/mod/github.com/fiatjaf/khatru@v0.10.1-0.20241106015918-76ecf4f7914a/blossom/utils.go:10 +0x115
haven-relay | github.com/fiatjaf/khatru/blossom.BlossomServer.handleUpload({{0xc000047200, 0x18}, {0x15d7108, 0xc00005dbe0}, {0xc000074ab8, 0x1, 0x1}, {0xc000074ac0, 0x1, 0x1}, ...}, ...)
haven-relay | /go/pkg/mod/github.com/fiatjaf/khatru@v0.10.1-0.20241106015918-76ecf4f7914a/blossom/handlers.go:92 +0x3e9
haven-relay | github.com/fiatjaf/khatru/blossom.New.func1({0x15d5b70?, 0xc000714380?}, 0x3?)
haven-relay | /go/pkg/mod/github.com/fiatjaf/khatru@v0.10.1-0.20241106015918-76ecf4f7914a/blossom/server.go:38 +0x105
haven-relay | net/http.HandlerFunc.ServeHTTP(0xc0000fca80?, {0x15d5b70?, 0xc000714380?}, 0x20?)
haven-relay | /usr/local/go/src/net/http/server.go:2220 +0x29
haven-relay | net/http.(*ServeMux).ServeHTTP(0xc0004acb60?, {0x15d5b70, 0xc000714380}, 0xc000f2e640)
haven-relay | /usr/local/go/src/net/http/server.go:2747 +0x1ca
haven-relay | github.com/fiatjaf/khatru.(*Relay).ServeHTTP.(*Cors).Handler.func3({0x15d5b70, 0xc000714380}, 0xc000f2e640)
haven-relay | /go/pkg/mod/github.com/rs/cors@v1.11.1/cors.go:289 +0x184
haven-relay | net/http.HandlerFunc.ServeHTTP(...)
haven-relay | /usr/local/go/src/net/http/server.go:2220
haven-relay | github.com/fiatjaf/khatru.(*Relay).ServeHTTP(0xc0001dfc08, {0x15d5b70, 0xc000714380}, 0xc000f2e640)
haven-relay | /go/pkg/mod/github.com/fiatjaf/khatru@v0.10.1-0.20241106015918-76ecf4f7914a/handlers.go:50 +0x378
haven-relay | main.dynamicRelayHandler({0x15d5b70?, 0xc000714380?}, 0x735507?)
haven-relay | /app/main.go:77 +0xa8
haven-relay | net/http.HandlerFunc.ServeHTTP(0x1e3e880?, {0x15d5b70?, 0xc000714380?}, 0x5?)
haven-relay | /usr/local/go/src/net/http/server.go:2220 +0x29
haven-relay | net/http.(*ServeMux).ServeHTTP(0x415345?, {0x15d5b70, 0xc000714380}, 0xc000f2e640)
haven-relay | /usr/local/go/src/net/http/server.go:2747 +0x1ca
haven-relay | net/http.serverHandler.ServeHTTP({0x15d1420?}, {0x15d5b70?, 0xc000714380?}, 0x6?)
haven-relay | /usr/local/go/src/net/http/server.go:3210 +0x8e
haven-relay | net/http.(*conn).serve(0xc00050d8c0, {0x15d7238, 0xc0004a2210})
haven-relay | /usr/local/go/src/net/http/server.go:2092 +0x5d0
haven-relay | created by net/http.(*Server).Serve in goroutine 1
haven-relay | /usr/local/go/src/net/http/server.go:3360 +0x485

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions