canvas::API method parse_link_value (protected)

 <instance of canvas::API[i]> parse_link_value link

Defined in packages/xooauth/tcl/canvas-procs.tcl

Parse the provided link.

Parameters:
link (required)

Testcases:
No testcase defined.
Source code:
# Link           = "Link" ":" #("<" URI ">" *( ";" link-param )
# link-param     = ( ( "rel" "=" relationship )
#                 | ( "rev" "=" relationship )
#                 | ( "title" "=" quoted-string )
#                 | ( "anchor" "=" <"> URI <"> )
#                 | ( link-extension ) )
# link-extension = token [ "=" ( token | quoted-string ) ]
set result ""
while {1} {
    if {$link eq ""} {
        break
    }
    set startURL [string first < $link]
    set endURL [string first > $link]
    if {$startURL == -1 || $endURL == -1 || $startURL > $endURL} {
        error "invalid link header field: '$link'"
    }
    set url [string range $link $startURL+1 $endURL-1]
    set remainder [string range $link $endURL+1 end]
    if {[regexp {^\s*[;]\s*(.*)$} $remainder . remainder]} {
        # has params
        set endParams [string first , $remainder]
        if {$endParams == -1} {
            set params $remainder
            set remainder ""
        } else {
            set params [string range $remainder 0 $endParams-1]
            set remainder [string range $remainder $endParams+1 end]
        }
        set params [:parse_link_params [split $params ";"]]
        lappend result [list url $url params $params]
    }
    set link $remainder
}
return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: