Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Sources/CustomHTTPProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public class CustomHTTPProtocol: URLProtocol {
if CustomHTTPProtocol.property(forKey: Constants.RequestHandledKey, in: request) != nil {
return false
}

if request.url?.scheme == "wss" || request.url?.scheme == "ws" {
Copy link

@robnadin robnadin Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a static property similar to ignoredHosts that could be configured instead?

We've recently run into this issue whilst trying to use Starscream with native WebSocket APIs and we wouldn't necessarily be interested in logging any of the WebSocket traffic, but this would be our choice only; for us, ignoring specific hosts is not an option as we use AWS and it would be very difficult to manage. It would feel like a better approach rather than hardcode these exceptions like what is done here.

return false
}

return true
}

Expand Down