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 { ...@@ -14,20 +14,22 @@ ad_page_contract {
# Security & Permissions # 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" 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 # Fetch and return the page
# #
if {[catch { if {"" eq $json} {
set json [im_httpget $url] if {[catch {
} err_msg]} { set json [im_httpget $url]
set json "{\"success\": false, \"message\": \"Error message: $err_msg\"}" } 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