[FASTCGI] n00b question, fastcgi returning JSON
luke at eversosoft.com
Wed Aug 19 20:10:27 EDT 2009
OK, well I gave up on "application/json".
Google appears to serve JSON responses with "Content-type: text/
The header parser in the apache fastCGI module is clearly a particular
kind of beast, and it chokes in a variety of ways that cause a n00b
like myself to wonder what the heck is going on. Also seemed to need
to restart Apache at times, after errors, but the circumstances are
lost in the fog of war.
Anyway, it seems that this all had very little to do with FastCGI per
On 19-Aug-09, at 3:00 PM, Luke Evans wrote:
> Apologies in advance as I have a feeling this is a super 'duh'
> question, and may only be obliquely related to fastcgi. However...
> Having traversed the mires of getting my first FastCGI server built
> and successfully hosted by Apache to return HTML, I thought I would
> make a trivial change to the MIME type to have it return a JSON
> string instead.
> Here's part of the code, patterned after the fastcgi C sample code:
> //"Content-type: application/json\r\n"
> "Content-type: text/html\r\n"
> Now, the code as it stands works fine, and my browser displays the
> contents of "responseCString", which is some JSON text.
> However, if I comment out the second line, and uncomment the first
> (to change the content type to befit the actual payload), I suddenly
> get web errors logged:
> [Wed Aug 19 14:33:33 2009] [error] [client 192.168.1.5] FastCGI:
> incomplete headers (32 bytes) received from server "/Library/
> AFAICT the change to the header is correct and there's no change to
> the overal structure of the response. Yet this change is sufficient
> to induce an error.
> It could be that I'm flying by the seat of my pants somehow with it
> working in the text/html case, or perhaps application/json is
> disallowed for some reason?
> Anyway, I'm sure there's a rather trivial reason for the failure and
> I'm hoping that someone with even a little more experience in things
> "web servery" will see the problem right away.
> -- Luke
> FastCGI-developers mailing list
> FastCGI-developers at mailman.fastcgi.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the FastCGI-developers