Am 12.12.2012 17:44, schrieb Jean-Michel Caricand:
Le 12/12/2012 15:49, Jean-Michel Caricand a écrit :
Hello,
...
Ok, I found my mistake. I must write "Location:", not "Location"

reply.setHeader("Location:", "http://localhost/doc.pdf";, true);

Under Apache 2, I write :
apr_table_setn(r->headers_out, "Location", ""http://localhost/doc.pdf";);

not

apr_table_setn(r->headers_out, "Location:", ""http://localhost/doc.pdf";);

Jean-Michel
Right. This is somewhat stupid, that tntnet expects this ':' at the end, but it is too late to change. I wish I had decided to go without ':'. The reason, why I decided is, that there is one header in mime transfer encoding, where the header comes without this ':'.

To help a little, you can use the constant "tnt::httpheader::location" from include file "tnt/httpheader.h".

The location header is used for redirects, so maybe you want to write just:

   return reply.redirect("http://localhost/doc.pdf";);

I feel, that this is more readable. You can even omit the "return" since reply.redirect throws a redirect exception and hence never return. It is defined with int return type to make it clearer, that you jump out of the current component.

Tommi
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to