Skip to content

Commit

Permalink
index: do not escape info message
Browse files Browse the repository at this point in the history
But do that for the errors, if any.

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe committed Nov 14, 2024
1 parent cc19ba9 commit 0b966dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion flask_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def mptcp_status_page():
addr = f"{addr}:{port}"

state_info = ''
state_error = ''
try:
conn = check_output(["ss", "-MnH", "dst", f"{addr}", "dport", f"{port}"]).decode("ascii")
if conn.startswith("ESTAB"):
Expand All @@ -46,7 +47,7 @@ def mptcp_status_page():
except Exception as e:
state_message = 'are maybe, or maybe not (internal error)'
state_class = 'error'
state_info = 'Error: ' + str(e)
state_error = 'Error: ' + str(e)

if user.startswith("curl"):
return "You " + state_message + " using MPTCP.\n"
Expand All @@ -55,6 +56,7 @@ def mptcp_status_page():
state_message=state_message,
state_class=state_class,
state_info=state_info,
state_error=state_error,
host=host)

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion flask_app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h2>MPTCP Connection Status</h2>
</div>
</div>
<p>
{{ state_info }}
{{ state_info|safe }}{{ state_error }}
</p>

<h2>cURL</h2>
Expand Down

0 comments on commit 0b966dc

Please sign in to comment.