MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / callManagementHandler

Method callManagementHandler

internal/pluginhost/management.go:329–341  ·  view source on GitHub ↗
(ctx context.Context, record managementRouteRecord, req pluginapi.ManagementRequest)

Source from the content-addressed store, hash-verified

327}
328
329func (h *Host) callManagementHandler(ctx context.Context, record managementRouteRecord, req pluginapi.ManagementRequest) (resp pluginapi.ManagementResponse, err error) {
330 if h == nil || record.route.Handler == nil || h.isPluginFused(record.pluginID) || !h.pluginIdentityCurrent(record.pluginID, record.path, record.version) {
331 return pluginapi.ManagementResponse{}, nil
332 }
333 defer func() {
334 if recovered := recover(); recovered != nil {
335 h.fusePlugin(record.pluginID, "ManagementHandler.HandleManagement", recovered)
336 resp = pluginapi.ManagementResponse{}
337 err = fmt.Errorf("management handler panic: %v", recovered)
338 }
339 }()
340 return record.route.Handler.HandleManagement(ctx, req)
341}
342
343func escapeManagementResponseBody(resp pluginapi.ManagementResponse) []byte {
344 body, okEscaped := htmlsanitize.JSONBodyIfLikely(resp.Body, resp.Headers.Get("Content-Type"))

Callers 1

ServeManagementHTTPMethod · 0.95

Calls 4

isPluginFusedMethod · 0.95
pluginIdentityCurrentMethod · 0.95
fusePluginMethod · 0.95
HandleManagementMethod · 0.65

Tested by

no test coverage detected