You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dobes Vandermeer <do...@gmail.com> on 2008/09/04 02:26:12 UTC

[users@httpd] Getting back HTTP as-is like plain text sometimes

For some reason I'm not getting any hits on my google searches for
this, so I'm trying this mailing list.

The issue I'm running into is that sometimes I get back the HTTP
response as plain text, instead of the *content* of the HTTP response
as the correct content type.  Many of my requests are served through a
reverse proxy to a glassfish server, but I've also seen this happen
for applications served directly by apache mod_php. Here's an example
of something that was returned to an AJAX query :

HTTP/1.1 200 OK
Date: Mon, 01 Sep 2008 21:52:55 GMT
Server: Sun Java System Application Server 9.1
X-Powered-By: Servlet/2.5
Content-Disposition: attachment
Content-Type: application/json;charset=utf-8
Content-Length: 55
Keep-Alive: timeout=15, max=37
Connection: Keep-Alive

//OK[1,["https://www.clarityaccounting.com/login"],0,3]

This example was served by glassfish, but I have also seen this with
PHP scripts returning something similar.

It doesn't happen consistently, nor does it seem to be targetting any
particular content-type or URL.

Has anyone seen this before?  Any ideas what might cause it?


-- 

Dobes Vandermeer
Director, Habitsoft Inc.
dobesv@habitsoft.com
778-891-2922

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dobes Vandermeer <do...@gmail.com>.
On Fri, Sep 5, 2008 at 10:32 AM, Dragon <dr...@crimson-dragon.com> wrote:
> Dobes Vandermeer did speak thusly:
>>
>> >
>> > OK, so then are you certain that the content type header is always being
>> > sent?
>>
>> Yes, as far as I can tell it is always included in the HTTP dump that
>> I get.  Besides, which content-type includes the HTTP response headers
>> in it?
>
> OK, after scanning through it pretty quickly, I have a suspicion what may be
> happening. I suspect a blank line is getting
> to the browser before the end of the headers and definitely before the
> content type header. In such a case, the browser is likely to default to
> plain text.

Yeah, that seems possible.  What I wonder about is that it happens so
infrequently - I haven't seen it for a few days now.  I'll keep an eye
out for it and try and devise a way to reproduce it more reliably.

I was hoping someone on the list had previously had this problem and
found a solution.

>> > Other than that, I am at a loss as to what might be happening.
>>
>> Me too :-(  I wish I could reproduce this more frequently so that I
>> could file a bug or something
>
> Well, we need a real good look at the HTTP transaction to determine that.

Thanks for your help.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dragon <dr...@crimson-dragon.com>.
Dobes Vandermeer did speak thusly:
> >
> > OK, so then are you certain that the content type header is always being
> > sent?
>
>Yes, as far as I can tell it is always included in the HTTP dump that
>I get.  Besides, which content-type includes the HTTP response headers
>in it?

I am not sure what you are asking there. As a result of an HTTP 
request to Apache, it will always send a series of headers before it 
sends content. I forget the exact specifics on this as I have not 
looked at the relevant RFC in quite a while. BTW, the relevant RFC 
for HTTP 1.1 is RFC2616

OK, after scanning through it pretty quickly, I have a suspicion what 
may be happening. When the HTTP server sends a response it sends a 
series of header lines including some details on the status of the 
request, a timestamp, and a variety of headers defining the content 
of the request. Each header line is terminated with a CRLF pair. The 
header section is then terminated with a blank line consisting of 
ONLY a CRLF pair. I suspect a blank line is getting to the browser 
before the end of the headers and definitely before the content type 
header. In such a case, the browser is likely to default to plain text.

> > I know you sent a list of headers in your original post and it was there,
> > but was that for a failed request or a successful one?
>
>It was a failed request - the only reason I had a copy of the headers
>was that I saw them in the browser window.

Which tends to support my theory above. If you saw them in the 
browser window, then the browser must have believed that the end of 
headers had already been sent and took everything beyond that to be 
plain text content.

This will require some more digging. If you have Firefox installed, 
you can use the LiveHeaders plugin to capture the request and 
response headers when you load the page. Or if you have a Linux or 
similar machine that supports wget, you can use it to do the same.

> > Other than that, I am at a loss as to what might be happening.
>
>Me too :-(  I wish I could reproduce this more frequently so that I
>could file a bug or something

Well, we need a real good look at the HTTP transaction to determine that.

You may need to do some more digging beyond that to see where the 
problem is occuring.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dobes Vandermeer <do...@gmail.com>.
On Thu, Sep 4, 2008 at 10:09 AM, Dragon <dr...@crimson-dragon.com> wrote:
> Dobes Vandermeer did speak thusly:
>>
>> On Thu, Sep 4, 2008 at 9:56 AM, Dragon <dr...@crimson-dragon.com> wrote:
>> > Dobes Vandermeer did speak thusly:
>> >>
>> >> For some reason I'm not getting any hits on my google searches for
>> >> this, so I'm trying this mailing list.
>> >>
>> >> The issue I'm running into is that sometimes I get back the HTTP
>> >> response as plain text, instead of the *content* of the HTTP response
>> >> as the correct content type.
>> >>
>> >> Has anyone seen this before?  Any ideas what might cause it?
>> >>
>> >
>> > Does the browser you are using know how to handle the content type?
>>
>> It seems to be happening for pretty standard content-types, such as
>> html pages on the site, so I seem like this is the issue.
>>
>> It also happens in different browsers.
>
> OK, so then are you certain that the content type header is always being
> sent?

Yes, as far as I can tell it is always included in the HTTP dump that
I get.  Besides, which content-type includes the HTTP response headers
in it?

> I know you sent a list of headers in your original post and it was there,
> but was that for a failed request or a successful one?

It was a failed request - the only reason I had a copy of the headers
was that I saw them in the browser window.


> Other than that, I am at a loss as to what might be happening.

Me too :-(  I wish I could reproduce this more frequently so that I
could file a bug or something


-- 

Dobes Vandermeer
Director, Habitsoft Inc.
dobesv@habitsoft.com
778-891-2922

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dragon <dr...@crimson-dragon.com>.
Dobes Vandermeer did speak thusly:
>On Thu, Sep 4, 2008 at 9:56 AM, Dragon <dr...@crimson-dragon.com> wrote:
> > Dobes Vandermeer did speak thusly:
> >>
> >> For some reason I'm not getting any hits on my google searches for
> >> this, so I'm trying this mailing list.
> >>
> >> The issue I'm running into is that sometimes I get back the HTTP
> >> response as plain text, instead of the *content* of the HTTP response
> >> as the correct content type.
> >>
> >> Has anyone seen this before?  Any ideas what might cause it?
> >>
> >
> > Does the browser you are using know how to handle the content type?
>
>It seems to be happening for pretty standard content-types, such as
>html pages on the site, so I seem like this is the issue.
>
>It also happens in different browsers.
---------------- End original message. ---------------------

OK, so then are you certain that the content type header is always being sent?

I know you sent a list of headers in your original post and it was 
there, but was that for a failed request or a successful one?

If it was not for a failed request, you will need to capture the 
headers on a failed request to see if it is there. The browser must 
know what the content type is in order to know what to do with it and 
if the header is missing, it
will have to just make a guess.

Other than that, I am at a loss as to what might be happening.



Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dobes Vandermeer <do...@gmail.com>.
On Thu, Sep 4, 2008 at 9:56 AM, Dragon <dr...@crimson-dragon.com> wrote:
> Dobes Vandermeer did speak thusly:
>>
>> For some reason I'm not getting any hits on my google searches for
>> this, so I'm trying this mailing list.
>>
>> The issue I'm running into is that sometimes I get back the HTTP
>> response as plain text, instead of the *content* of the HTTP response
>> as the correct content type.
>>
>> Has anyone seen this before?  Any ideas what might cause it?
>>
>
> Does the browser you are using know how to handle the content type?

It seems to be happening for pretty standard content-types, such as
html pages on the site, so I seem like this is the issue.

It also happens in different browsers.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Getting back HTTP as-is like plain text sometimes

Posted by Dragon <dr...@crimson-dragon.com>.
Dobes Vandermeer did speak thusly:
>For some reason I'm not getting any hits on my google searches for
>this, so I'm trying this mailing list.
>
>The issue I'm running into is that sometimes I get back the HTTP
>response as plain text, instead of the *content* of the HTTP response
>as the correct content type.  Many of my requests are served through a
>reverse proxy to a glassfish server, but I've also seen this happen
>for applications served directly by apache mod_php. Here's an example
>of something that was returned to an AJAX query :
>
>HTTP/1.1 200 OK
>Date: Mon, 01 Sep 2008 21:52:55 GMT
>Server: Sun Java System Application Server 9.1
>X-Powered-By: Servlet/2.5
>Content-Disposition: attachment
>Content-Type: application/json;charset=utf-8
>Content-Length: 55
>Keep-Alive: timeout=15, max=37
>Connection: Keep-Alive
>
>//OK[1,["https://www.clarityaccounting.com/login"],0,3]
>
>This example was served by glassfish, but I have also seen this with
>PHP scripts returning something similar.
>
>It doesn't happen consistently, nor does it seem to be targetting any
>particular content-type or URL.
>
>Has anyone seen this before?  Any ideas what might cause it?
>
---------------- End original message. ---------------------

I suspect this may well be a browser problem.

Does the browser you are using know how to handle the content type?

If not, it will likely either default to plain text or prompt you to 
save the content as a file.

Also IIRC, content disposition of attachment should cause the browser 
to prompt you to save the content.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org