RE: Help: HTTP response has wrong Content-Type field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Thank you very much for the response. 

We finally got the root cause. When we used the following code to set
content type, there will be problem. The reason is that Apache
ap_set_content_type does not copy the content to
request_rec::content_type, it only use the "const char*" pointer. When
our_module_handler returns, the pointer is released, so some strange
data is in content_type, and put back to HTTP response. We resolved it
by defining some "const char*" variables and set with them when calling
ap_set_content_type.

int our_module_handler(request_rec *r)
{
	....
	String data="<some value>"
	ap_set_content_type(r, data.c_str());
	....
}

Hongmei 

-----Original Message-----
From: Eric Covener [mailto:covener@xxxxxxxxx] 
Sent: Saturday, October 24, 2009 9:13 AM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  Help: HTTP response has wrong Content-Type
field

On Fri, Oct 23, 2009 at 8:59 PM, HE Hongmei
<Hongmei.He@xxxxxxxxxxxxxxxxxx> wrote:
>
> We added some logs before and after the above calls, and found the 
> content-type is always right. However, sometimes (not always), in the 
> response sent by Apache server, Content-Type will be changed to 
> something like "application/user-config" or 
> "application/user-config+xm", or some other values.

I suspect its your modules own misuse of r->pool.  Completely gut all of
your actual logic from your module and see if it still truncates the
header.

Or start with a new module that just sets the content type and prints a
canned response.

--
Eric Covener
covener@xxxxxxxxx

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux