You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Octavian Rasnita <or...@gmail.com> on 2008/06/14 14:24:51 UTC

[users@httpd] Downloading a CSV file

Hi,

I've made a program that creates a .csv file and offer it for downloading.

If a user uses Internet Explorer 6 to download the file and it chooses to 
right-click then "Save as..." from the context menu, the file is downloaded 
right.

But if the user just clicks or hits enter on the link for downloading that 
file, the user is asked what he wants to do, to save or open the file, and 
if he choses that he wants to save it, that window remains open and it 
doesn't ask for the name of the file.

I've used lwp-request (from ActivePerl) to see which are the HTTP headers 
received. Please tell me what should I change, add or remove in order to be 
able to download that file by just clicking on the link.

Thank you.

The headers are:

Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0, max-age=0
Connection: close
Date: Sat, 14 Jun 2008 12:09:38 GMT
Pragma: no-cache
Server: Apache/2.2.8 (Fedora)
Content-Length: 4358
Content-Type: text/csv
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Client-Date: Sat, 14 Jun 2008 12:13:49 GMT
Client-Peer: xx.xxx.xxx.xxx:80
Client-Response-Num: 1
Content-Disposition: attachment;filename="REGS--2008-06-13.csv"
Set-Cookie: zzzz=6eb405c4774a704757d6455963ec7bfc10810eb9; 
domain=www.tranzactiibursiere.ro; path=/
X-Catalyst: 5.7014


Octavian


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Downloading a CSV file

Posted by Octavian Rasnita <or...@gmail.com>.
And which should be those settings that all the page visitors should look for?

Thanks.

Octavian

----- Original Message ----- 
From: "Mohit Anchlia" <mo...@gmail.com>
To: <us...@httpd.apache.org>
Sent: Monday, June 16, 2008 2:42 AM
Subject: Re: [users@httpd] Downloading a CSV file


> Looks like you need to look for some settings on the browser.
> 
> On Sat, Jun 14, 2008 at 5:24 AM, Octavian Rasnita <or...@gmail.com>
> wrote:
> 
>> Hi,
>>
>> I've made a program that creates a .csv file and offer it for downloading.
>>
>> If a user uses Internet Explorer 6 to download the file and it chooses to
>> right-click then "Save as..." from the context menu, the file is downloaded
>> right.
>>
>> But if the user just clicks or hits enter on the link for downloading that
>> file, the user is asked what he wants to do, to save or open the file, and
>> if he choses that he wants to save it, that window remains open and it
>> doesn't ask for the name of the file.
>>
>> I've used lwp-request (from ActivePerl) to see which are the HTTP headers
>> received. Please tell me what should I change, add or remove in order to be
>> able to download that file by just clicking on the link.
>>
>> Thank you.
>>
>> The headers are:
>>
>> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>> pre-check=0, max-age=0
>> Connection: close
>> Date: Sat, 14 Jun 2008 12:09:38 GMT
>> Pragma: no-cache
>> Server: Apache/2.2.8 (Fedora)
>> Content-Length: 4358
>> Content-Type: text/csv
>> Expires: Thu, 01 Jan 1970 00:00:00 GMT
>> Client-Date: Sat, 14 Jun 2008 12:13:49 GMT
>> Client-Peer: xx.xxx.xxx.xxx:80
>> Client-Response-Num: 1
>> Content-Disposition: attachment;filename="REGS--2008-06-13.csv"
>> Set-Cookie: zzzz=6eb405c4774a704757d6455963ec7bfc10810eb9; domain=
>> www.tranzactiibursiere.ro; path=/
>> X-Catalyst: 5.7014
>>
>>
>> Octavian
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Downloading a CSV file

Posted by Mohit Anchlia <mo...@gmail.com>.
Looks like you need to look for some settings on the browser.

On Sat, Jun 14, 2008 at 5:24 AM, Octavian Rasnita <or...@gmail.com>
wrote:

> Hi,
>
> I've made a program that creates a .csv file and offer it for downloading.
>
> If a user uses Internet Explorer 6 to download the file and it chooses to
> right-click then "Save as..." from the context menu, the file is downloaded
> right.
>
> But if the user just clicks or hits enter on the link for downloading that
> file, the user is asked what he wants to do, to save or open the file, and
> if he choses that he wants to save it, that window remains open and it
> doesn't ask for the name of the file.
>
> I've used lwp-request (from ActivePerl) to see which are the HTTP headers
> received. Please tell me what should I change, add or remove in order to be
> able to download that file by just clicking on the link.
>
> Thank you.
>
> The headers are:
>
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
> pre-check=0, max-age=0
> Connection: close
> Date: Sat, 14 Jun 2008 12:09:38 GMT
> Pragma: no-cache
> Server: Apache/2.2.8 (Fedora)
> Content-Length: 4358
> Content-Type: text/csv
> Expires: Thu, 01 Jan 1970 00:00:00 GMT
> Client-Date: Sat, 14 Jun 2008 12:13:49 GMT
> Client-Peer: xx.xxx.xxx.xxx:80
> Client-Response-Num: 1
> Content-Disposition: attachment;filename="REGS--2008-06-13.csv"
> Set-Cookie: zzzz=6eb405c4774a704757d6455963ec7bfc10810eb9; domain=
> www.tranzactiibursiere.ro; path=/
> X-Catalyst: 5.7014
>
>
> Octavian
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Downloading a CSV file

Posted by André Warnier <aw...@ice-sa.com>.

Doug McNutt wrote:
> At 14:55 +0200 6/14/08, André Warnier wrote:
>> And, by the way, your HTTP headers above are absolutely correct as per the specs, if you want the file to be downloaded, and the "suggested" file name to be what you indicate.
>> It's just that IE doesn't care, and has its own ideas about this.
>>
> 
> As a scientist rather than a web programmer I have used ftp for a lot longer than http is old.
> 
> My offerings as HTML anchors, served by apache, usually point to fully specified ftp:// URI's which I keep in an ftp directory which is accessible via ordinary ftp clients. I haven't had any complaints about strange formats and filename extensions including .tsv but rarely .csv. The browsers, including IE, seem to pass the problem to an ftp plugin without complaint.
> 
As a programmer rather than a scientist, from before ftp even existed, 
why didn't I think of that myself ?
There may be a problem once in a while with a firewall, but it should 
still work in many cases, and avoid these @#/¿¡+]^^! header issues.
It should even be possible to use Apache as the ftp server.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Downloading a CSV file

Posted by Doug McNutt <do...@macnauchtan.com>.
At 14:55 +0200 6/14/08, André Warnier wrote:
>
>And, by the way, your HTTP headers above are absolutely correct as per the specs, if you want the file to be downloaded, and the "suggested" file name to be what you indicate.
>It's just that IE doesn't care, and has its own ideas about this.
>

As a scientist rather than a web programmer I have used ftp for a lot longer than http is old.

My offerings as HTML anchors, served by apache, usually point to fully specified ftp:// URI's which I keep in an ftp directory which is accessible via ordinary ftp clients. I haven't had any complaints about strange formats and filename extensions including .tsv but rarely .csv. The browsers, including IE, seem to pass the problem to an ftp plugin without complaint.

-- 
-->  The best programming tool is a soldering iron <--

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Downloading a CSV file

Posted by André Warnier <aw...@ice-sa.com>.

Octavian Rasnita wrote:
> Hi,
> 
> Content-Type: text/csv
> Content-Disposition: attachment;filename="REGS--2008-06-13.csv"

And, by the way, your HTTP headers above are absolutely correct as per 
the specs, if you want the file to be downloaded, and the "suggested" 
file name to be what you indicate.
It's just that IE doesn't care, and has its own ideas about this.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Downloading a CSV file

Posted by André Warnier <aw...@ice-sa.com>.
Hi.

I suggest that you first make the following search in Google :
ie +"mime type"
and then read some.
It will tell you what you are up against.

In summary :
The behaviour of various versions and sub-versions of Internet Explorer 
with respect to files received from a HTTP server, is variable, erratic, 
and in most cases conflicts with the specifications of the relevant 
Internet RFCs.
(I am hereby referring to the "Content-type" and "Content-disposition" 
headers).

In the practice, it means that if you find one set of HTTP headers that 
works with one IE version/revision, it probably will not do the same 
with other versions/revisions.  In addition, I have found that even with 
identical versions of IE, sometimes client stations will still react 
differently, depending on which (other) program is installed on the 
workstation.  (For example, you may find that depending on whether your 
client has or not MS-Excel installed on his workstation, the behaviour 
of IE versus your CSV files will change).
And since you cannot exactly control which version of IE your client is 
using, nor the programs installed on his workstation, you're in trouble.

The only way that I have found to get a more or less consistent 
behaviour, is to "sniff out" the IE version used by the client (see the 
"User-Agent" request header), and adapt the headers you send in function 
of that.
It's not pretty and no fun.
It will also probably cost you many hours of lost time explaining the 
same over and over to your users and their system administrators, hours 
for which MS will not compensate you.

If anyone else on this list has a different experience and a better 
solution, please let us know.

Note that this topic has alrady been discussed ad nauseam in a multitude 
of lists and web discussions, so adding your own complaint will probably 
just be a drop in the ocean.
But I could not resist warning this new victim.

André

Octavian Rasnita wrote:
> Hi,
> 
> I've made a program that creates a .csv file and offer it for downloading.
> 
> If a user uses Internet Explorer 6 to download the file and it chooses 
> to right-click then "Save as..." from the context menu, the file is 
> downloaded right.
> 
> But if the user just clicks or hits enter on the link for downloading 
> that file, the user is asked what he wants to do, to save or open the 
> file, and if he choses that he wants to save it, that window remains 
> open and it doesn't ask for the name of the file.
> 
> I've used lwp-request (from ActivePerl) to see which are the HTTP 
> headers received. Please tell me what should I change, add or remove in 
> order to be able to download that file by just clicking on the link.
> 
> Thank you.
> 
> The headers are:
> 
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
> pre-check=0, max-age=0
> Connection: close
> Date: Sat, 14 Jun 2008 12:09:38 GMT
> Pragma: no-cache
> Server: Apache/2.2.8 (Fedora)
> Content-Length: 4358
> Content-Type: text/csv
> Expires: Thu, 01 Jan 1970 00:00:00 GMT
> Client-Date: Sat, 14 Jun 2008 12:13:49 GMT
> Client-Peer: xx.xxx.xxx.xxx:80
> Client-Response-Num: 1
> Content-Disposition: attachment;filename="REGS--2008-06-13.csv"
> Set-Cookie: zzzz=6eb405c4774a704757d6455963ec7bfc10810eb9; 
> domain=www.tranzactiibursiere.ro; path=/
> X-Catalyst: 5.7014
> 
> 
> Octavian
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org