Closed Bug 1530125 Opened 6 years ago Closed 5 years ago

Investigate the use case of nsBaseChannel::ClassifyURI

Categories

(Toolkit :: Safe Browsing, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: dimi, Unassigned)

References

Details

As far as I know, the protocols we need to check for SafeBrowsing/Tracking protection are:

  1. http/https
  2. ftp
  3. ws/wss(web socket)

http/https are handled in nsHttpChannel.
ws/wss are based upon http/https so we could probably check there.

So the only use for nsBaseChannel::ClassifyURI[1] is for FTP if I don't miss anything. If this is true, we can use some information in the channel to avoid creating nsChannelClassifier and then call Start()[2]

[1] https://searchfox.org/mozilla-central/rev/dc0adc07db3df9431a0876156f50c65d580010cb/netwerk/base/nsBaseChannel.cpp#296

(In reply to Dimi Lee [:dimi][:dlee] from comment #0)

ws/wss are based upon http/https so we could probably check there.

What do you mean by this? The channel itself isn't: https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/netwerk/protocol/websocket/WebSocketChannel.h#64 (but it also isn't based on nsBaseChannel!)

One thing to note here, with bug 1404744 fixed, if we know somehow that the top-level page is HTTP, we really don't care about FTP at all.

(In reply to :Ehsan Akhgari from comment #1)

(In reply to Dimi Lee [:dimi][:dlee] from comment #0)

ws/wss are based upon http/https so we could probably check there.

What do you mean by this? The channel itself isn't: https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/netwerk/protocol/websocket/WebSocketChannel.h#64 (but it also isn't based on nsBaseChannel!)

Sorry for my very bad description here.

What I really mean is to establish a WebSocket connection, it sends an HTTP request first for websocket protocol handshake, not really it "bases" on HTTP. As you said, ws/wss is nothing related to nsBaseChannel. I was trying to list all cases here and
figure out what are the possible use cases in nsBaseChannel.

For FTP, I guess we still need it for SafeBrowsing? We can use FTP for top-level load which may still point to a bad URL.

Flags: needinfo?(ehsan)

(In reply to Dimi Lee [:dimi][:dlee] from comment #3)

(In reply to :Ehsan Akhgari from comment #1)

(In reply to Dimi Lee [:dimi][:dlee] from comment #0)

ws/wss are based upon http/https so we could probably check there.

What do you mean by this? The channel itself isn't: https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/netwerk/protocol/websocket/WebSocketChannel.h#64 (but it also isn't based on nsBaseChannel!)

Sorry for my very bad description here.

What I really mean is to establish a WebSocket connection, it sends an HTTP request first for websocket protocol handshake, not really it "bases" on HTTP. As you said, ws/wss is nothing related to nsBaseChannel. I was trying to list all cases here and
figure out what are the possible use cases in nsBaseChannel.

Yes indeed.

For FTP, I guess we still need it for SafeBrowsing? We can use FTP for top-level load which may still point to a bad URL.

Yeah. As you know, this code is only used for safebrowsing, so I think that is the remaining use case. :-)

Flags: needinfo?(ehsan)
Priority: -- → P2

this is done.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.