To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.admin.generalOpen lugnet.admin.general in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Administrative / General / 7549
7548  |  7550
Subject: 
Ldraw.cgi (was: Re: More newbie questions)
Newsgroups: 
lugnet.cad, lugnet.admin.general
Followup-To: 
lugnet.admin.general
Date: 
Thu, 17 Aug 2000 17:20:23 GMT
Viewed: 
42 times
  
In lugnet.cad, Tim Courtney writes:
"Steve Bliss" <blisses@worldnet.att.net> wrote in message
news:6jqnpsg4q0shhd01dkjovv4a49ennsbcbh@4ax.com...
In lugnet.cad, Paul Sinasohn wrote:

3) Why, when i click the DAT link in the LUGNET web interface, do I get a
default file name of LDRAW.CGI for the dat file?

The file-type isn't registered correctly.  I don't know how to fix this,
but I wouldn't associate CGI with MLCAD.

Why not?  AFAIK, that's the only way to do it, if you want it to be
automatic.  Otherwise you have to select 'open with' each time.  At least
that's my experience.  I didn't read anything for that, I just played around
though :)  So, if there is a better way, please LMK.  All I know is that
works for me.

I don't want to jump to conclusions here, since I'm less experienced at this
than Todd, but I think this is what's happening:

- User clicks the "DAT" link. This link points to a CGI script on LUGNET,
  named "ldraw.cgi", which is in charge of returning the dat file.
- When a CGI is requested to download data, it's got to print out the headers
  (MIME type, etc) that tell the receiving browser what type of data it's
  getting back. In this case (for a download) it's probably:
  "Content-type: octet-stream"
- When the Browser gets this back, it realizes that it's getting a FILE, and
  not just an HTML page. Hence, it looks for the name of the file in the
  headers. If it can't find one, it will by default name the file it's
  downloading the same name as the script-- in this case "ldraw.cgi", instead
  of "whatever.dat".

Certainly when I started CGI programming, I had no way of knowing that this
was fixable-- it doesn't seem to be common knowledge. The only way around the
problem I knew was to name the CGI script "BLAH.DAT" instead of "BLAH.CGI",
which is annoying from a coding standpoint.

How to fix this: (from LUGNET's standpoint)
This can actually be fixed by changing the headers to:

Content-type: application/octet-stream; name="blah.dat"\n
Content-Disposition: attachment; filename="blah.dat"\n\n

I'm not sure if BOTH name and filename are necessary-- that might just be a
browser compatibility issue, but for whatever reason, I was recommended (by a
more adept CGI coder) to use that as a header for downloads.

And of course, this may not even be the problem, or Todd may have done what he
did for a good reason, I have no idea. But anyway, as far as I can tell (not
very far, of course), that could be the problem...

How to fix this from a user standpoint:

You CAN associate .cgi files with ldraw/whatever, but keep in mind that's bad
form. if some other .cgi program has the same issue elsewhere online, and you
try and download some other application that by default has a .cgi extention,
it'll open it with ldraw or whatever application you dictate. Also, if you are
for some reason running cgi scripts on your PC (if you have a webserver or
something? Not very likely, probably, but hey, maybe it could happen) then
double clicking them will invoke ldraw, and you probably don't want to do
that...

Anyway, my $.02..
HTH,

DaveE



Message is in Reply To:
  Re: More newbie questions
 
"Steve Bliss" <blisses@worldnet.att.net> wrote in message news:6jqnpsg4q0shhd0...4ax.com... (...) Why not? AFAIK, that's the only way to do it, if you want it to be automatic. Otherwise you have to select 'open with' each time. At least that's my (...) (24 years ago, 17-Aug-00, to lugnet.cad)

26 Messages in This Thread:









Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR