PDA

View Full Version : Anonoymous FTP URL



Armadillo
04-18-2004, 11:17 PM
I thought I had this problem fixed, but I guess I dont.

I have anonoymous FTP on my site, with links to items for users to download.
The thing is, IE can not find the file unless the URL is formatted one way while Netscape/Mozilla needs the URL another way.

Examples-
IE URL- ftp://domain.com/ftp/pub/anonymous/somefile.exe
Moz URL- ftp://domain.com/somefile.exe
They both point to the same files.

Why would there be a difference? Is it because of the browser or because of a FTP server problem?

If a Moz user clicks the IE link the path gets doubled and it cant find anything. If a IE user clicks the Moz link it cant find anything.
I tried putting a symlink in my web directory but it didnt help.

Tested on IE6, Netscape 4.5, 6, Mozilla, Firebird, Firefox.

wildjokerdesign
04-19-2004, 02:45 AM
Not really sure if any of this applies to the problem you are having but did some digging around and came up with this.

I have a php script that handles uploading and viewing of attachments. There is a an option for using FTP that I don't use but looking in the part of the script that handles it there is one section that for security reason on changes the mimetype of all files depending on the browser. For IE and Opera it changes it to application/octetstream for other browsers it makes it application/octet-stream which makes me wonder if that could be part of the problem. Notice the subtle difference of a "-" seperating octet and stream. Looking at the httpd.conf it lead me to the file it reads to determin mimetypes which is located at /etc/mime.types . In that file it has all exe file set to application/octect-stream.

Now the httpd.conf also reads a file located at /usr/share/magic.mime and conf/magic for the module mime magic if that module is installed which it is not by default you would have to install it. I found the first file but it did not look like it had anything you could change and I could not find the second file which I would imagin might have something. It may not be there since the module is not installed but you might do a search on that module to see if it may be of help. Accourding to the file I did read it tries to dertermin the correct mime type but did not say specificly if that included any checks on browser types.

It looks like httpd.conf does use the module mod_mime.c and it is installed but I did not track that one down to check it out.

So that is what I came up with. Now if for some reason you can't get the ftp thing worked out then it may be that you could do something with the php script files to get this working. They are actually part of a modification that you can add to a phpBB board so you would most likely have to do some heavy moding on them to fit your needs. The way I am using it I don't even use FTP like I mentioned the files are simply stored on a directory in my public www area and it seems to work well with all browser types for downloading the files.

Let us know if you come up with anything from all that and if I can find anything else I'll let you know.

wildjokerdesign
04-19-2004, 11:09 AM
I found this page on the Apache site that has information on the module mod_mime with I belive is what is being used for mime types on our accounts. http://httpd.apache.org/docs-2.0/mod/mod_mime.html It is what I was talking about when I said mod_mime.c in my previous post.

There is alot of info on the page and even talks about ModMimeUsePathInfo Directive wich may have something to do with it. Lots of See also links on the page.

There is also a page on mod_mime_magic here http://httpd.apache.org/docs-2.0/mod/mod_mime_magic.html

Armadillo
04-19-2004, 06:19 PM
Thanks wildjoker, I'm going to look into that as soon as I have time.
I'm not using PHP for FTP, just a direct link, but maybe ModMimeUsePathInfo has somthing to do with it.

I noticed that IE will open the Moz link in "folder view" if it's typed into the location bar. I can even download items that way. But, if its just a link to a file it does not work. It's very odd.
I never needed two seperate FTP links for Moz/IE on WH 1.0.

wildjokerdesign
04-19-2004, 06:47 PM
If this is stuff that you are uploading to your site and you don't need to let others upload to it via annon ftp then I think that maybe you could put the files in your www directory and simply use the ftp://yourdomain.com/thedirectorytheyarein/file.exe . I think that I used that once way back when and it worked. Things may be very different now but it can't hurt to try.

If that worked you could even put a .htaccess file in it to make a link to the directory list the files so folks could simply go to that directory and browse what is in it and then download what they want. You can make that look nice by putting a README.html and HEADER.html file in the directory that wraps the file listing. The .htaccess file looks like this

Options +Indexes
IndexIgnore *.html

The HEADER.html is at the top of the page and then the README.html is at the bottom of the page when it is displayed. You can see an example of how it looks to the user here http://puppetsandstuff.com/freepage/

Just more options.

Armadillo
04-20-2004, 01:47 AM
FTPing via a link into the WWW area doesnt work.

I tried disabling and re-enabling anonymous FTP and moving it to a new directory "/pub". It didnt do any good. Moz still doubles the path with the IE link.
So.... I created a "pub" directory in my "pub" directory and copied everything into it. Now, when Netscape/Mozilla gets a "ftp://domain/pub/file.exe" link and searches for "ftp://domain/pub/pub/file.exe" it will at least find something.

Not a very good solution, and it takes up space, but it works.

Does anyone have any idea what causes this? It's really strange. I need to read up on that mime stuff before I look into that.