Redirect weirdness
Hi all, I wanted to see which of my links are getting clicked, so I made each links go to a little script which builds the url and then does a RESPONSE.redirect. This works fine for redirects to html pages, but gives a very odd result for PDFs. A new window opens as expected, the correct URL appears in the address bar but in the title bar at the top of the browser window is the address of my script, 'display source' is disabled (explorer), and in the Z2.log entry, the useragent signature is replaced by 'contype'. Evidently this has to do with the content-type of the page, but I am at a loss about what to do. Can I set a content-type header along with the redirect? I've searched... I wanted this to be automatic, and the only hint about the content-type would be from the string '.pdf' in the URL... Any explanations out there? And where did 'contype' come from?? Cheers, Ken
On Sat, 2 Nov 2002, Ken wrote:
I wanted this to be automatic, and the only hint about the content-type would be from the string '.pdf' in the URL... And where did 'contype' come from??
this is a good question, i experience the same thing. not with redirects, zope (or apache?) seems to change the content-type fo the document sometimes... yesterday i had a dtml method working fine, i pasted in another text, and the content-type became application/octet-stream ... after several hours of bugging, i found a character ( ยด instead of ' ) that made all this, i removed it, then it worked fine .... whats this? what is playing with the content-type header and why? i think it shouldnt do this unless i tell it to do ... k -- don't believe everything you think
keo writes:
.... yesterday i had a dtml method working fine, i pasted in another text, and the content-type became application/octet-stream ... When you do not set a "Content-Type" header explicitly, then ZPublisher tries to guess one:
When it sees binary data, it assumes "application/octet-stream". Otherwise, it assumes "text". When it sees an "<html>", it uses "text/html", otherwise "text/plain". Usually, Zope objects, especially "File" objects set an explicit "Content-Type", guessed when the object is created and modifyable with the management interface. Dieter
On Sun, 3 Nov 2002, Dieter Maurer wrote:
keo writes:
.... yesterday i had a dtml method working fine, i pasted in another text, and the content-type became application/octet-stream ... When you do not set a "Content-Type" header explicitly, then ZPublisher tries to guess one:
When it sees binary data, it assumes "application/octet-stream".
Otherwise, it assumes "text". When it sees an "<html>", it uses "text/html", otherwise "text/plain".
Usually, Zope objects, especially "File" objects set an explicit "Content-Type", guessed when the object is created and modifyable with the management interface.
is it possible to hardcode content-type to be text/html for all ZPT and DTML by default? then if i send something else i set it myself ... what counts to be binary for ZPublisher? k -- don't believe everything you think
keo writes:
... is it possible to hardcode content-type to be text/html for all ZPT and DTML by default? Sure, when you change the source... But, I think, it would not be a good idea:
These objects are often called locally (rather than via ZPublisher). What a surprise, when you set your "Content-Type" explicitly to something else and a local call magically changes it to "text/html". A probably better way it to set it in your "standard_html_header" or "main_template". Dieter
participants (3)
-
Dieter Maurer -
Ken -
keo