<div>Bob,</div><div><br></div><div>We use options 1, 2 and 3.</div><div><br></div><div>Your proposal certainly has merits.</div><div><br></div><div>I agree with Brian on setting content type. We do the same regularly.</div><div><br></div><div>Ken</div><div><br><div class="gmail_quote"><div>On Sat, 1 Apr 2017 at 07:15, Brian K. White via Filepro-list <<a href="mailto:filepro-list@lists.celestial.com">filepro-list@lists.celestial.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Content-type may be set a couple different ways.<br class="gmail_msg">
<br class="gmail_msg">
If the file is being served by a cgi, the a cgi may write whatever kind<br class="gmail_msg">
of http headers it wants, including content-type.<br class="gmail_msg">
<br class="gmail_msg">
If the file is being served by the web server directly, then you can<br class="gmail_msg">
define new custom content types in the mime-types file, or by special<br class="gmail_msg">
httpd.conf directives, (which probably means .htaccess directives can do<br class="gmail_msg">
it also)<br class="gmail_msg">
<br class="gmail_msg">
But for the sake of simplicity I'll show the two most common/basic ways<br class="gmail_msg">
to get a mime-type set<br class="gmail_msg">
<br class="gmail_msg">
A) cgi. In place of a plain url to a file, you have a url to a cgi<br class="gmail_msg">
script that squirts a file at the client.<br class="gmail_msg">
<br class="gmail_msg">
The cgi might look like this:<br class="gmail_msg">
...cgi-bin/login.vnc:<br class="gmail_msg">
---<br class="gmail_msg">
#!/bin/ksh<br class="gmail_msg">
printf "Content-Type: VncViewer/Config\n\n"<br class="gmail_msg">
# [...]<br class="gmail_msg">
cat ${TEMPLATE}.vnc<br class="gmail_msg">
printf "host=%s\r\n" $HOST<br class="gmail_msg">
printf "port=%s\r\n" $PORT<br class="gmail_msg">
---<br class="gmail_msg">
<br class="gmail_msg">
The only http header in this case is "Content-Type: VncViewer/Config".<br class="gmail_msg">
http header is nothing more than whatever lines are first emitted by the<br class="gmail_msg">
script (any script, any number of lines) until the first empty line.<br class="gmail_msg">
Everything after the first empty line is the content. So the 2nd "\n" on<br class="gmail_msg">
the printf makes the empty line which ends the headers and starts the<br class="gmail_msg">
content.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
B) mime-types. Alternatively, the web server can be told to recognize<br class="gmail_msg">
files by their filename extensions, and send a specified content-type<br class="gmail_msg">
matched to a file extension. They are defined in mime-types, which might<br class="gmail_msg">
appear in a few different common places on the server depending on the<br class="gmail_msg">
servers apache config. (Other web servers like nginx will have some<br class="gmail_msg">
equivalent but I don't know their details)<br class="gmail_msg">
<br class="gmail_msg">
So for instance on my opensuse boxes, the file is in /etc/mime-types,<br class="gmail_msg">
and I have these lines added to the end:<br class="gmail_msg">
VncViewer/Config vnc<br class="gmail_msg">
application/facetwin fwt<br class="gmail_msg">
application/mstsc rdp<br class="gmail_msg">
application/<a href="http://vnd.aljex.at" rel="noreferrer" class="gmail_msg" target="_blank">vnd.aljex.at</a> at<br class="gmail_msg">
<br class="gmail_msg">
There is VncViewer/Config again. If I had a static foo.vnc file sitting<br class="gmail_msg">
on the server and had a url to it, there is no cgi shell script to write<br class="gmail_msg">
headers. The web server itself generates a few http headers for the<br class="gmail_msg">
response when it sends the requested file, and this tells the web server<br class="gmail_msg">
to use VncViewer/Config instead of text/plain or<br class="gmail_msg">
application/octet-stream for any *.vnc files.<br class="gmail_msg">
<br class="gmail_msg">
C) I'm pretty sure there are yet other ways you could define the<br class="gmail_msg">
behavior you want even more specially by httpd.conf and .htaccess rules,<br class="gmail_msg">
but I just don't happen to know those details off hand.<br class="gmail_msg">
<br class="gmail_msg">
The CLIENT OS can also recognize a file by it's extension even if the<br class="gmail_msg">
web server doesn't send the right content-type, but that is unreliable.<br class="gmail_msg">
That is why you sometimes get .csv files that show up as text in the<br class="gmail_msg">
browser instead of downloaded and opened by your default spreadsheet<br class="gmail_msg">
app, or sometimes for example it works in IE but not in Firefox, for the<br class="gmail_msg">
same file from the same server to the same client.<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
bkw<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
On 3/31/2017 1:24 PM, Bob Rasmussen via Filepro-list wrote:<br class="gmail_msg">
> On Fri, 31 Mar 2017, Kenneth Brody wrote:<br class="gmail_msg">
><br class="gmail_msg">
>> Is it possible to have a new "Content-Type", such as<br class="gmail_msg">
>> "application/X-PrintWizard", which could be returned as the result of<br class="gmail_msg">
>> a "normal" HTTP link?<br class="gmail_msg">
><br class="gmail_msg">
> I don't know. I believe the content-type is determined by the web<br class="gmail_msg">
> server, but I don't know how it does so. Do you know this?<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> Regards,<br class="gmail_msg">
> ....Bob Rasmussen,   President,   Rasmussen Software, Inc.<br class="gmail_msg">
><br class="gmail_msg">
> personal e-mail: <a href="mailto:ras@anzio.com" class="gmail_msg" target="_blank">ras@anzio.com</a><br class="gmail_msg">
>  company e-mail: <a href="mailto:rsi@anzio.com" class="gmail_msg" target="_blank">rsi@anzio.com</a><br class="gmail_msg">
>           voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)<br class="gmail_msg">
>             fax: (US) 503-624-0760<br class="gmail_msg">
>             web: <a href="http://www.anzio.com" rel="noreferrer" class="gmail_msg" target="_blank">http://www.anzio.com</a><br class="gmail_msg">
>  street address: Rasmussen Software, Inc.<br class="gmail_msg">
>                  10240 SW Nimbus, Suite L9<br class="gmail_msg">
>                  Portland, OR  97223  USA<br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> Filepro-list mailing list<br class="gmail_msg">
> <a href="mailto:Filepro-list@lists.celestial.com" class="gmail_msg" target="_blank">Filepro-list@lists.celestial.com</a><br class="gmail_msg">
> Subscribe/Unsubscribe/Subscription Changes<br class="gmail_msg">
> <a href="http://mailman.celestial.com/mailman/listinfo/filepro-list" rel="noreferrer" class="gmail_msg" target="_blank">http://mailman.celestial.com/mailman/listinfo/filepro-list</a><br class="gmail_msg">
><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Filepro-list mailing list<br class="gmail_msg">
<a href="mailto:Filepro-list@lists.celestial.com" class="gmail_msg" target="_blank">Filepro-list@lists.celestial.com</a><br class="gmail_msg">
Subscribe/Unsubscribe/Subscription Changes<br class="gmail_msg">
<a href="http://mailman.celestial.com/mailman/listinfo/filepro-list" rel="noreferrer" class="gmail_msg" target="_blank">http://mailman.celestial.com/mailman/listinfo/filepro-list</a><br class="gmail_msg">
</blockquote></div></div>