+ if( cur[0] == '\r' && cur[1] == '\n' &&
+ cur[2] == '\r' && cur[3] == '\n' )
+ {
+ cur += 4;
+ break;
+ }
+ }
+
+ if( cur >= end )
+ {
+ hb_log("Error: Found the end of the buffer before the end of the HTTP header information! \n");
+ goto error;
+ }
+
+ /*
+ * Find the <cli> tag
+ * Scan though each character of the buffer until we find that the first 4 characters of "cur" are "<cli"
+ */
+ for(i=0 ; &cur[3] < end; i++, cur++ )
+ {
+ if( cur[0] == 'c' && cur[1] == 'l' && cur[2] == 'i' && cur[3] == '>' )
+ {
+ cur += 1;
+ break;
+ }
+
+ // If the CLI tag has not been found in the first 768 characters, or the end is reached, something bad happened.
+ if (( i > 768) || ( cur >= end ))
+ {
+ hb_log("Error: Did not find the <cli> tag in the expected maximum amount of characters into the file. \n");
+ goto error;
+ }
+ }
+
+ if( cur >= end )
+ {
+ goto error;
+ }
+
+ /*
+ * Ok, The above code didn't position cur, it only found <cli so we need to shift cur along 3 places.
+ * After which, the next 10 characters are the build number
+ */
+ cur += 3;
+
+ if( cur >= end )
+ {
+ hb_log("Error: Unexpected end of buffer! Could not find the build information. \n");
+ goto error;
+ }
+
+ /* UnStable HB_BUILD */
+ unstable = strtol( cur, &cur, 10 );
+
+ if( cur >= end )
+ {
+ hb_log("Error: Unexpected end of buffer! \n");
+ goto error;
+ }
+
+ /*
+ * The Version number is 2 places after the build, so shift cur, 2 places.
+ * Get all the characters in cur until the point where " is found.
+ */
+ cur += 2;
+
+ if( cur >= end )
+ {
+ hb_log("Error: Unexpected end of buffer! Could not get version number. \n");