Commit 717d6121 authored by cosine's avatar cosine

Restricted to https?://*.project-open.net/ domain, produce JSON error message instead of TCL error

parent 39298b94
......@@ -14,20 +14,22 @@ ad_page_contract {
# Security & Permissions
#
if {![regexp {^https://www\.project-open\.[a-z]+} $url match]} {
ad_return_complaint 1 "Domain-proxy: This proxy can relay information only from project-open.* domains"
ad_script_abort
}
ns_log Notice "/intranet-rest/data-source/domain-proxy.tcl: url=$url"
set json ""
if {![regexp {^https?://www\.project-open\.net/} $url match]} {
set json "{\"success\": false, \"message\": \"Domain-proxy: This proxy can relay information only from https://*.project-open.net domains\"}"
# ad_return_complaint 1 "Domain-proxy: This proxy can relay information only from project-open.* domains"
# ad_script_abort
}
# --------------------------------------------
# Fetch and return the page
#
if {[catch {
set json [im_httpget $url]
} err_msg]} {
set json "{\"success\": false, \"message\": \"Error message: $err_msg\"}"
if {"" eq $json} {
if {[catch {
set json [im_httpget $url]
} err_msg]} {
set json "{\"success\": false, \"message\": \"Error message: $err_msg\"}"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment