Re: Generating "download" pages [message #186417 is a reply to message #186413] |
Sat, 19 July 2014 20:54 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 7/19/2014 4:06 PM, Christoph M. Becker wrote:
> Thomas 'PointedEars' Lahn wrote:
>
>> Christoph M. Becker wrote:
>>
>>> and AFAIK there is no such thing as multipart responses for HTTP.
>>
>> There is; that is the purpose of the “Content-Disposition” header field.
>>
>> <http://tools.ietf.org/html/rfc6266>
>
> Um, I am somewhat confused. RFC 6266 says (emphasis mine):
>
> | The Content-Disposition response header field is used to convey
> | additional information about *how to process the response payload*,
> | and also can be used to attach additional metadata, such as the
> | filename to use when *saving the response payload locally*.
>
> This seems to be completely different then e.g. "Content-Type:
> multipart/alternative" for emails.
>
>> | Response Headers (source)
>> |
>> | HTTP/1.1 302 Found
>> | Location:
>> http://netcologne.dl.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlu gin_0.2.11_E30.zip
>>
>> Note that the response body is displayed as empty.
>
> This is not surprising, as the HTTP response status code is "302 Found",
> which redirects to the URI given in the Location header field.
>
>> I think the relevant fact here is that the target resource is served with
>> “Content-Type: application/octet-stream”, because that is known to trigger a
>> download dialog instead of navigation.
>
> ACK. However, the content that could be saved, is the payload of the
> very response that contained the Content-Type header field.
>
>> <http://stackoverflow.com/questions/283752/refresh-http-header>
>
> Thanks for the confirmation.
>
> [Sorry, I had to snip more of the former discussion than I liked,
> because my newsserver doesn't all ow too much quoted content.]
>
Christopher,
Don't worry, Pointed Head is just showing his ignorance again. You are
correct - you can't send two different URLs as a response to a single
request.
The easiest way to do it, IMHO, is to just put a javascript request in
the onload event (of the <body> tag). Have that perform the download.
Arno's idea is interesting, also. I admit I haven't tried it, but it
would be worth looking at when I get a few minutes, probably next week.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
|
|
|