Closed Bug 1479488 Opened 6 years ago Closed 3 years ago

307 Redirect from ftp to http with http proxy leads to wrong url in location bar

Categories

(Core :: Networking, defect, P3)

61 Branch
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: olaf, Unassigned)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

283 bytes, application/x-javascript
Details
Attached file proxy-mock.js
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Build ID: 20180621125625

Steps to reproduce:

1) setup a proxy that responds to the first request with a 307 redirect to an http:// location, to all other requests an HTML page with a relative link.
2) do a FTP request

To reproduce: run attached proxy mock with "node proxy-mock.js", point your proxy to localhost:8080, do a request ftp://test/ftp (not working) or http://test/ftp (working)


Actual results:

FF:
1) sends ftp://.. request to proxy
2) reads redirect
3) sends http://... request to proxy
4) gets html page
5) shows page but does not change url in location bar at the top, still old ftp://
6) If you now click on the relative link, the wrong resource (ftp://...) is requested.


Expected results:

5) location bar should show the new URL (http://...)
6) links should be resolved relative to the new location.

Works fine with http (host is changed), does not work for ftp.
Component: Untriaged → Address Bar
This doesn't look like an address Bar problem, could be something with the docshell, especially because of the links.
I think there is some caching of redirects
Component: Address Bar → Document Navigation
Product: Firefox → Core
This seems invalid, the FTP protocol doesn't have a concept of redirects. The server code you provided looks an awful lot like an HTTP server, not an FTP server. So it only makes sense that trying to talk FTP to it won't work.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
FTP also does not have the concept of a proxy. Firefox is using FTP over HTTP, and in this scenario the response is HTTP and not FTP, only the URL protocol is FTP.

The redirect is caused by the proxy itself. This is common practice for (security) internet gateways intercepting the traffic. It used to work for older versions of Firefox.
Apologies, I acted too hastily. All browsers want to rid themselves of FTP support as far as I know so this might have been a side effect of that happening. In any case, Necko folks will know.
Component: Document Navigation → Networking
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
This appears to be because firefox uses "GET ftp://<host>:<port>/..." for proxied requests, instead of "CONNECT host:port". This... isn't ideal (since FTP is non-HTTP, we should really use CONNECT), but it's not entirely busted, either (plenty of proxies accept the GET form and handle it properly). This has been our behaviour since time immemorial, as far as I can tell. Since this is our first complaint so far as I can see, I don't think this is going to be super high-priority to get fixed.
Priority: -- → P3
Whiteboard: [necko-triaged]

No. You cannot do a CONNECT request to a HTTP proxy, otherwise the browser has to speak FTP with the proxy (this will break at least for active FTP). FTP over HTTP is a known protocol there the HTTP proxy will translate HTTP to FTP, i.e., the proxy will do the FTP stuff including the generation of HTML directory listings.

This used to work fine with older Firefox versions.

FTP code has been removed.

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago3 years ago
Resolution: --- → WONTFIX
See Also: → kill-ftp
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: