Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
717d6121
Commit
717d6121
authored
Apr 06, 2023
by
cosine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restricted to https?://*.project-open.net/ domain, produce JSON error message instead of TCL error
parent
39298b94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
domain-proxy.tcl
www/data-source/domain-proxy.tcl
+12
-10
No files found.
www/data-source/domain-proxy.tcl
View file @
717d6121
...
...
@@ -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
\"
}"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment