Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.140.2.44 -r1.140.2.45 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 30 May 2016 13:07:46 -0000 1.140.2.44 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 16 Aug 2016 18:27:10 -0000 1.140.2.45 @@ -254,10 +254,16 @@ return $result } -ad_proc -public get_referrer {} { - gets the Referer for the headers -} { - return [ns_set get [ns_conn headers] Referer] +ad_proc -public get_referrer {-relative:boolean} { + @return referer from the request headers. + @param relative return the refer without protocol and host +} { + set url [ns_set get [ns_conn headers] Referer] + if {$relative_p} { + # In case the referrer URL has a protocol and host remove it + regexp {^[a-z]+://[^/]+(/.+)$} $url . url + } + return $url } ##