CGI: search and set Status header in RFC 3875 compliant way.

By CGI Version 1.1 (http://www.ietf.org/rfc/rfc3875) the order of header fields in a response is not significant (section 6.2. of the RFC), and one possible solution is to first search for Status/Location headers as in this pull request. Current implementation assumes that Status or Location headers come first, which breaks some applications.