- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::nsmcp::Server
::nsmcp::Servercreate ... \
[ -path (default "/mcp") ] \
[ -transport:required transport:required ]
Defined in /usr/local/ns/tcl/nsmcp/lib/transport.tcl
Class Relations
::nx::Class create ::nsmcp::Server \ -superclass ::nx::ObjectMethods (to be applied on instances)
http (scripted, public)
<instance of nsmcp::Server> http
- Testcases:
- No testcase defined.
set headers {} set input [ns_conn headers] for {set i 0} {$i < [ns_set size $input]} {incr i} { set name [string tolower [ns_set key $input $i]] # Do not silently select one of several authentication/origin headers. if {[dict exists $headers $name] && $name in {authorization origin content-type mcp-protocol-version}} { ns_return 400 text/plain "Duplicate request header" return } if {[dict exists $headers $name]} { dict append headers $name , [ns_set value $input $i] } else { dict set headers $name [ns_set value $input $i] } } if {[ns_conn contentlength] > [${:transport} maxBodyBytes]} { ns_return 413 text/plain "Request body too large" return } try { set response [${:transport} request [ns_conn method] $headers [ns_conn content] [ns_conn server]] set contentType text/plain dict for {key value} [dict get $response headers] { if {[string equal -nocase $key Content-Type]} { set contentType $value } else { ns_set put [ns_conn outputheaders] $key $value } } ns_set put [ns_conn outputheaders] Cache-Control no-store ns_return [dict get $response status] $contentType [dict get $response body] } on error {message options} { ns_log error "nsmcp: HTTP adapter failed" ns_return 500 text/plain "Internal error" } finally { ::nsmcp::cleanup }install (scripted, public)
<instance of nsmcp::Server> install
- Testcases:
- No testcase defined.
::nsmcp::install_cleanup foreach method {POST GET DELETE PUT PATCH OPTIONS HEAD} { ns_register_proc -noinherit $method ${:path} [list [self] http] }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
![[i]](/resources/acs-subsite/ZoomIn16.gif)