Skip to content

Commit

Permalink
Merge pull request ZeroNetX#217 from caryoscelus/http-accept-asterisk
Browse files Browse the repository at this point in the history
don't fail if http_accept header is */*
  • Loading branch information
caryoscelus authored Jul 21, 2023
2 parents f06050c + 3330b19 commit 00f298a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Ui/UiRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,9 @@ def actionWrapper(self, path, extra_headers=None):
if self.isWebSocketRequest():
return self.error403("WebSocket request not allowed to load wrapper") # No websocket

if "text/html" not in self.env.get("HTTP_ACCEPT", ""):
return self.error403("Invalid Accept header to load wrapper: %s" % self.env.get("HTTP_ACCEPT", ""))
http_accept = self.env.get("HTTP_ACCEPT", "")
if "text/html" not in http_accept and "*/*" not in http_accept:
return self.error403(f"Invalid Accept header to load wrapper: {http_accept}")
if "prefetch" in self.env.get("HTTP_X_MOZ", "") or "prefetch" in self.env.get("HTTP_PURPOSE", ""):
return self.error403("Prefetch not allowed to load wrapper")

Expand Down

0 comments on commit 00f298a

Please sign in to comment.