added extra checks for eof while reading and parsing gzip header structure