mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 23:26:54 +08:00
server: remove OnOptions
This commit is contained in:
@@ -223,24 +223,6 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) {
|
||||
|
||||
switch req.Method {
|
||||
case base.Options:
|
||||
if h, ok := sc.s.Handler.(ServerHandlerOnOptions); ok {
|
||||
pathAndQuery, ok := req.URL.RTSPPath()
|
||||
if !ok {
|
||||
return &base.Response{
|
||||
StatusCode: base.StatusBadRequest,
|
||||
}, liberrors.ErrServerNoPath{}
|
||||
}
|
||||
|
||||
path, query := base.PathSplitQuery(pathAndQuery)
|
||||
|
||||
return h.OnOptions(&ServerHandlerOnOptionsCtx{
|
||||
Conn: sc,
|
||||
Req: req,
|
||||
Path: path,
|
||||
Query: query,
|
||||
})
|
||||
}
|
||||
|
||||
var methods []string
|
||||
if _, ok := sc.s.Handler.(ServerHandlerOnDescribe); ok {
|
||||
methods = append(methods, string(base.Describe))
|
||||
|
@@ -39,19 +39,6 @@ type ServerHandlerOnResponse interface {
|
||||
OnResponse(*base.Response)
|
||||
}
|
||||
|
||||
// ServerHandlerOnOptionsCtx is the context of an OPTIONS request.
|
||||
type ServerHandlerOnOptionsCtx struct {
|
||||
Conn *ServerConn
|
||||
Req *base.Request
|
||||
Path string
|
||||
Query string
|
||||
}
|
||||
|
||||
// ServerHandlerOnOptions can be implemented by a ServerHandler.
|
||||
type ServerHandlerOnOptions interface {
|
||||
OnOptions(*ServerHandlerOnOptionsCtx) (*base.Response, error)
|
||||
}
|
||||
|
||||
// ServerHandlerOnDescribeCtx is the context of a DESCRIBE request.
|
||||
type ServerHandlerOnDescribeCtx struct {
|
||||
Conn *ServerConn
|
||||
|
Reference in New Issue
Block a user