Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.php Subject: Re: Generating "download" pages Date: Sun, 20 Jul 2014 00:48:58 +0200 Organization: PointedEars Software (PES) Lines: 133 Message-ID: <22681408.NiNFdGaATJ@PointedEars.de> References: <6H9yv.30802$el1.16727@fx26.iad> <6732922.VsfUzaneRC@PointedEars.de> <1978758.sLNZCN5jEe@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1405810140 20622 eJwFwQkBwDAIA0BLhHeVA3TxL6F3YYnc8oz0YJAc/W3n6jSpLotvaOaifdovCimNAw3eEj44kBFz (19 Jul 2014 22:49:00 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Sat, 19 Jul 2014 22:49:00 +0000 (UTC) User-Agent: KNode/4.12.4 X-User-ID: eJwNyckRwDAIBLCWgOUsx14P/ZeQ6KtAarI8Iz02FuK3ReaRh9O2/9KlnuZceDVbC8TSsS/mCOgqltkmA3xCuRRr Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. 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. >> >> > > 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. It is not all that different. >> | Response Headers (source) >> | >> | HTTP/1.1 302 Found >> | Location: >> http://netcologne.dl.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlugin_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. ACK. It would appear I was partially mistaken and you were right. The link on sourceforge.net appears to be no different than any other download link, except that server-side redirection is used. >> 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. Not necessarily. Such content can be part of a multi-part message. >> > > Thanks for the confirmation. I have created testcases: The first and third one redirect/refresh to All three trigger the download dialog in Chromium 34. However, only the latter also displays the HTML document at the same time, even though I specified a relative URI-reference. Since the “Refresh” header field is so far a non-standard feature, either it should not be used or it should be used as an alternative to client-side scripting (as you suggested), with a “direct link” in case neither works (as SourceForge does). One must decide for either HTTP or client-side scripting as using both might trigger the download two times. “download-multipart” and “download-refresh” take parameters to use “Content- Disposition: inline” instead of “attachment”, and to use the “meta” element instead of the HTTP header field, respectively. Append “.phps” to the URIs for the source code. I still do not understand why SourceForge would use the “Content- Disposition” header field in their redirect as the message body truly is empty: $ GET -Se 'http://downloads.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlugin_0.2.11_E30.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fviplugin%2F&ts=1405807555&use_mirror=heanet' | head -n 30 GET http://downloads.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlugin_0.2.11_E30.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fviplugin%2F&ts=1405807555&use_mirror=heanet 302 Found Connection: close Date: Sat, 19 Jul 2014 22:08:02 GMT Location: http://heanet.dl.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlugin_0.2.11_E30.zip Server: lighttpd Content-Length: 0 Content-Type: text/html Client-Date: Sat, 19 Jul 2014 22:08:02 GMT Client-Peer: 216.34.181.59:80 Client-Response-Num: 1 Content-Disposition: attachment; filename="viPlugin_0.2.11_E30.zip" Set-Cookie: sf_mirror_attempt=viplugin:heanet:/viplugin/viplugin/0.2.11/viPlugin_0.2.11_E30.zip; expires=Sat, 19-Jul-2014 22:10:02 GMT; Path=/ X-Frame-Options: SAMEORIGIN GET http://heanet.dl.sourceforge.net/project/viplugin/viplugin/0.2.11/viPlugin_0.2.11_E30.zip 200 OK Connection: close Date: Sat, 19 Jul 2014 22:08:02 GMT Accept-Ranges: bytes ETag: "1011c768e-2752f-3d7fa7c386b00" Server: Apache/2.2.14 Content-Length: 161071 Content-Type: application/octet-stream Last-Modified: Tue, 13 Apr 2004 22:35:56 GMT Client-Date: Sat, 19 Jul 2014 22:08:05 GMT Client-Peer: 193.1.193.66:80 Client-Response-Num: 1 PK[zipped content] > [Sorry, I had to snip more of the former discussion than I liked, > because my newsserver doesn't allow too much quoted content.] I know what you mean as I am also using this server and recommended it to you. This is its major (but AFAICS only) disadvantage. TINSTAAFL. PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs,