Do not loop forever after reaching start of file.

StringIO.seek doesn't raise an error when trying to rewind past the start of file, resulting in an infinite loop. Nasty for web services as this can be used for DoS.