Closed Bug 107516 Opened 23 years ago Closed 9 years ago

Proxy: Form posting to FTP (POST method)

Categories

(Core :: Networking, defect)

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: o.krueckel, Unassigned)

References

()

Details

(Whiteboard: [needs review/super-review])

Attachments

(3 files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.5) Gecko/20011011
BuildID:    2001101117

If I select the "Download Now" button at the page I get the follow error msg.

ERROR
The requested URL could not be retrieved

While trying to retrieve the URL: ftp://ftp.microimages.com/pub/mix/mix_3_0_8.exe

The following error was encountered:

    * Unsupported Request Method and Protocol

Squid does not support all request methods for all access protocols. For
example, you can not POST a Gopher request.

Your cache administrator is root.
Generated Tue, 30 Oct 2001 08:40:30 GMT by proxy.visa.intranet.at
(Squid/2.4.STABLE2)

It works fine with Konqueror 2.2.1 and IE 5

Reproducible: Always
Steps to Reproduce:
1. open the site http://www.microimages.com/mix/
2. klick the button "Download Now"
3. now you can see the error
wfm using build 2001102903 on Win2k.
Definitely a mozilla/proxy interaction issue.
wfm too, on Win95, 2001102903. File downloaded succesfully under a proxy server
connection.
WFM 2001102903 on Win2k; marking as such. 

Reporter: Your build is old. Please try a more recent build and reopen this bug
if it still occurs for you: 
http://ftp.mozilla.org/pub/mozilla/nightly/latest/mozilla-win32-talkback.zip
(as always, be sure to delete your old Mozilla directory before installing the
new one)

-> File Handling
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Component: Browser-General → File Handling
Resolution: --- → WORKSFORME
guys: if you aren't using the same proxy and it's a proxy bug, i'd request that
you not RESO WFM it.
Status: RESOLVED → UNCONFIRMED
Component: File Handling → Networking: HTTP
QA Contact: doronr → benc
Resolution: WORKSFORME → ---
I can reproduce it with Mozilla on Linux, build 2001111821.  It's because the
form is *POST*ing to an FTP URL.  Mozilla pass the POST operation on to Squid,
which then complains about not being able to POST to an FTP URL.
reassign to networking
Assignee: asa → darin
QA Contact: benc → tever
Status: UNCONFIRMED → NEW
Ever confirmed: true
That url has <form method="POST"> with the ftp url.

I guess we could just GET it, but what if there is form data? this is probably
proxy only because the ftp code doesn't deal with POST at all.

Does ns4 handle this?
We could just make sure we always GET for ftp:// urls in the form submission 
code....  that code is already doing some special-casing of mailto:, iirc.
well... once nsIUploadChannel is fully implemented in HTTP... this could be
trivially resolved.  the FTP impl of nsIUploadChannel simply does an FTP PUT to
the server.  if that fails... well then... bad site, right?
ignore my last comment... i didn't understand this bug well enough.  we need to
study how IE5/konqueror handle this case.

-> badami for investigation

vinay: you'll need to setup a squid proxy server for this one.  let me know if
you need help setting one up.
Assignee: darin → badami
Status: NEW → ASSIGNED
taking from vinay
Assignee: badami → nivedita
Status: ASSIGNED → NEW
This patch sets the method as GET, if the scheme is ftp.

Though this fixes the bug, I am not sure if I am breaking the ftp during the
form submission by making it as "GET" always. I am concerned about the ftp
upload happening when the user uses the html form element <input type=file ...>
and the action url is ftp server. Is ftp upload valid this way and if yes, can
some one provide a test case for it, where in I test ftp upload, so as to fix
this bug completely.
Comment on attachment 72578 [details] [diff] [review]
patch for fixing ftp download

You should be testing for !http, rather than ftp explictly.

I wonder if this should be done in the http proxy code instead. If we're not
speaking real http, use GET not POST and assert if there is a body.

This won't affect ftp upload, since using the proxy doesn't actually use the
ftp code. Mind you, if POST to an ftp url is invalid, I'm not sure how ftp
upload via a proxy is meant to work. Maybe something else needs to error out,
or only conditionally QI to nsIUploadChannel?
Attachment #72578 - Flags: needs-work+
Keywords: patch
Whiteboard: [needs review/super-review]
Incorporated comments given by Bradley Baetz. Checking for !http instead of is
ftp.

However I would like to clarify, is it safe to set method as "GET" always for
the protocols other than http or https?
Comment on attachment 72925 [details] [diff] [review]
patch file incorporating comments given by Bradley Baetz

>Index: html/content/src/nsFormSubmission.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/content/html/content/src/nsFormSubmission.cpp,v
>retrieving revision 1.4
>diff -u -r1.4 nsFormSubmission.cpp
>--- html/content/src/nsFormSubmission.cpp	2002/02/27 15:49:54	1.4
>+++ html/content/src/nsFormSubmission.cpp	2002/03/07 05:25:24
>@@ -260,6 +260,18 @@
>                                      nsIInputStream** aPostDataStream)
> {
>   nsresult rv = NS_OK;
>+  PRBool isHttp = PR_TRUE;
>+  PRBool isHttps = PR_TRUE;
>+  aURI->SchemeIs("http", &isHttp);
>+  if (!isHttp) {
>+      aURI->SchemeIs("https", &isHttps);  
>+  }
>+

Check for errors here. Don't early return, just assume that failure means that
its not http/https.

>+  if ( (!isHttp) || (!isHttps) )  {

That should be &&, shouldn't it? (And similarly below)

>+      mMethod = NS_FORM_METHOD_GET;
>+      isHttp = PR_FALSE;
>+      isHttps = PR_FALSE;
>+  }
> 

GET is always safe - the names are from HTTP. There should probably be an
assertion that there isn't a file upload
or something for the form submission., but thats a separate issue.
Attachment #72925 - Flags: needs-work+
>+  if ( (!isHttp) || (!isHttps) )  {

That should be &&, shouldn't it? (And similarly below)

Since the scheme could either be HTTP or HTTPS, not both for a given url, hence 
the check should be ||. 
> Since the scheme could either be HTTP or HTTPS, not both for a given url, hence 
> the check should be ||. 

But you're testing the negative - (!http) || (!https) === !(http && https),
which will always evaluate to true, because a scheme is never http and https.
yes, got it. Incorporated the comments given by Bradley Baetz.
.
Assignee: nivedita → pavlov
i think this was assigned to me on accident
Assignee: pavlov → darin
Target Milestone: --- → Future
Summary: Download Button at http://www.microimages.com/mix/ → Form posting to FTP (POST method) via proxy problem
I'm reading this, and still not clear:

What is the correct behavior here, and why? I've raised the same issue for form
submits to a file URL, and nobody has ever told what would make sense.
QA Contact: tever → httpqa
Summary: Form posting to FTP (POST method) via proxy problem → Proxy: Form posting to FTP (POST method)
-> default owner
Assignee: darin → nobody
Component: Networking: HTTP → Networking
QA Contact: networking.http → networking
Target Milestone: Future → ---
new ftp features are the realm of addons now
Status: NEW → RESOLVED
Closed: 23 years ago9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: