Reading CLRF from HTTP request to website

Hi,

I am successfully posting to a server and I am reading the response and I would like to strip out the header. I have been reading here: HTTP/1.1: Response that when a site returns data that after the headers a CRLF appears and that after it only the data is left. I have tried to do that with this bit of code:

while (client.connected()) {
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
      if(!found)
      {
        if(r_found)
        {
          if(c == '\n')
          {
            found = true; 
            Serial.println("FOUND");
          }
          else
          {
            r_found = false; 
          }
        }
        if(c == '\r')
        {
          r_found = true;                 
        }
      }
      else
      {
        Serial.print(c);
        response += c; 
      }
    }
  }

The serial output to this is:
HTTP/1.1 200 OK
FOUND
DDaattee:: MMoonn,, 1199 MMaayy 22001144 2200::4433::5588 GGMMTT
etc...

As you can see my response variable contains everything except for the firstline of the headers. I believe that the CRLF should only appear once, however, it appears that my code picks it up on the first line. I want a way to find this CRLF.

(The reason for the double characters in the output is that when the CRLF is found it the prints out the value of c again as I wanted to see what would be going into the variable response)

The HTTP header is separated from the data by a blank line. The blank line is a CR/LF pair. Note however that each non-blank line in the header will be terminated by CR/LF. Your code looks for the first CR/LF pair which occurs at the end of the first line in the header. You need to look for two CR/LF pairs in a row.