I have written a very simple program reading information from the FastCGI server. All it does it accepts the socket with file descriptor 0, and 'pukes' all data it receives from the server into a raw.binary (1KB). I received 926 bytes, but the file is 1014 long because the buffer had that size.
I tried to manually analyze the data using this FastCGI Specification, but the data doesn't seem to match what that specification tells me.
The first 2 bytes both equal 1. Great, this means protocol version 1, type 1. (Which represents the beginning of a request. )
The next 2 bytes make up an int16 containing 1. Also this is as expected, because this is the request ID, and 1 is the first request.
The next 2 bytes however, (hexadecimal) 00 08
, tell me the content length is 8... This cannot be possible though, there is a lot of content not even in range of this 8 value as you can see if you have downloaded the binary gibberish.
What am I doing wrong?
The server sent 2 records. The first record is indeed 8 bytes long.