2 Commits

Author SHA1 Message Date
jdl
728b34b684 Fix streaming handlers for https. 2023-12-03 20:26:27 +01:00
jdl
8be663a0a0 Fix streaming handlers for https. 2023-12-03 20:24:36 +01:00
2 changed files with 11 additions and 0 deletions

View File

@@ -12,6 +12,13 @@ const (
pathStreamWAL = "stream-wal" pathStreamWAL = "stream-wal"
) )
func (rep *Replicator) RegisterHandlers(mux *http.ServeMux, rootPath string) {
mux.HandleFunc(path.Join(rootPath, pathGetInfo), rep.handleGetInfo)
mux.HandleFunc(path.Join(rootPath, pathSendState), rep.handleSendState)
mux.HandleFunc(path.Join(rootPath, pathStreamWAL), rep.handleStreamWAL)
}
// TODO: Remove this!
func (rep *Replicator) Handle(w http.ResponseWriter, r *http.Request) { func (rep *Replicator) Handle(w http.ResponseWriter, r *http.Request) {
// We'll handle two types of requests: HTTP GET requests for JSON, or // We'll handle two types of requests: HTTP GET requests for JSON, or
// streaming requets for state or wall. // streaming requets for state or wall.

View File

@@ -183,3 +183,7 @@ func (db *Database) addCollection(id uint64, c collection, collectionState any)
func (db *Database) Handle(w http.ResponseWriter, r *http.Request) { func (db *Database) Handle(w http.ResponseWriter, r *http.Request) {
db.rep.Handle(w, r) db.rep.Handle(w, r)
} }
func (db *Database) RegisterHandlers(mux *http.ServeMux, rootPath string) {
db.rep.RegisterHandlers(mux, rootPath)
}