On Wed, Jan 7, 2009 at 07:14, Juhani Connolly <[email protected]> wrote: > I'm currently working on modifying a php based application into an apache > module. > > The short of it is that I want to send a Location header with a 0 content > length message and headers for cache-control and pragma. > Setting the headers, and returning HTTP_MOVED_TEMPORARILY the additional > headers are stripped and the default message is sent. > Using ErrorDocument in my httpd.conf to use a 0 length file, the content > length is correctly set to 0, but even the Location header gets stripped. > I am pretty sure the cause of my issue is unrelated to the additional > headers, just needing me to send no content which is confusing the problem > handsets. How can I cause this behaviour? > > For anyone interested, the background of the situation, some source after > the background: > > In addition to logging an access to an image, this module will redirect the > request based on some parameters to a different server. The php version > would send Location, pragma: no-cache, cache-control: no-cache, > must-revalidate and 0 content length, which worked perfectly for all > clients. > Within the module I have set the location header as well as the pragma and > cache-control, however only the location will go through, and the default > 302 message is sent. This is not generally a problem, except for with one of > the local mobile phone handset manufacturers which fails to redirect the > image correctly claiming a bad image. > Thus I am attempting to emulate the behaviour of the php, being unsure of > which part is causing the problem. Most likely it would be the content being > sent confusing the handset. Honestly I'd like to just ignore the particular > manufacturer, but this is not an option. > > Some source(stripped down to the essentials... In the actual version there's > error handling and whatnot): > > curl_easy_setopt(hCurl, CURLOPT_URL, adUrl); // url to get the redirect > location from > curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, &outUrl); > curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, outUrlWrite); > > if(curl_easy_perform(hCurl) == 0) > { > apr_table_setn(r->headers_out, "Location", outUrl); > } > > r->content_type = CONTENT_TYPE_MOBILE; > > apr_table_setn(r->headers_out, "Cache-Control", "no-cache, > must-revalidate"); > apr_table_setn(r->headers_out, "Pragma", "no-cache"); > > curl_easy_cleanup(hCurl); > > return HTTP_MOVED_TEMPORARILY; >
Use r->err_headers_out instead of r->headers_out. If it does not work, there's a longer and more complicated solution based on insert_error_filter. Come back for details if err_headers_out does not solve the problem. -- Sorin -- A: Because it reverses the logical flow of conversation. Q: Why is top-posting frowned upon? A: Top-posting. Q: What is the most annoying thing in e-mail?
