nsmcp::summaryRequestUrl (private)
nsmcp::summaryRequestUrl text
Defined in /usr/local/ns/tcl/nsmcp/examples/nsmcp-openacs-api-docs.tcl
Extract a bounded request path and method from a warning message. @return Path, method and reason fields.
- Parameters:
- text (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set selected {} foreach line [split $text \n] { if {![regexp {^:[ \t]+([A-Z][A-Z0-9_-]{0,31}) ([^ \t\r\n]+) referred by [^\r\n]* peer [^ \t\r\n]+ user_id [^ \t\r\n]+(?: user_agent[^\r\n]*)?[ \t]*$} $line -> method target]} { continue } set request [list $method $target] if {$selected ne {} && $request ne $selected} { return {path {} method unknown reason conflicting} } set selected $request } if {$selected eq {}} { return {path {} method unknown reason missing} } lassign $selected method target if {$method ni {GET POST HEAD PUT DELETE OPTIONS PATCH CONNECT TRACE}} { set method other } if {[string index $target 0] eq "/"} { set path $target } elseif {[regexp -nocase {^https?://[^/?#[:space:]]+([^[:space:]]*)$} $target -> path]} { if {$path eq {} || [string index $path 0] in {? #}} { set path / } } else { return [dict create path {} method $method reason unsupported] } regexp {^[^?#]*} $path path if {$path eq {} || [string index $path 0] ne "/" || [regexp {[\x00-\x20\x7f]} $path]} { return [dict create path {} method $method reason unsupported] } if {[string length [encoding convertto utf-8 $path]]>1024} { return [dict create path {} method $method reason oversized] } return [dict create path $path method $method reason known]XQL Not present: Generic, PostgreSQL, Oracle