htp_connp_close: handle streams in error state

A stream in the error state would not be handled correctly by
htp_connp_close. The error state would be overwritten to 'CLOSED'
and the final handling of the stream would follow.

This lead to a case where a null pointer dereference could happen.

If for whatever reason inflateInit2 failed, the stream would get
into an error state. By resetting the state, the parser would
later unconditionally invoke the decompressor. As it's setup
failed, this resulted in a null dereference.

This patch makes sure that htp_connp_close doesn't overwrite
the state. The functions called by htp_connp_close are able
to deal with an error state properly.
Merge pull request #82 from inliniac/fix-close-v0

htp_connp_close: handle streams in error state
Added glongo
Updated for 0.5.16
Harden decompress code against memory stress

Under severe memory pressure the decompress code can fail to setup
properly. Add checks before dereferencing pointers.
Improve request line parsing with leading spaces

Leading spaces (or whitespace in general, so tabs etc as well) on the
request line are silently accepted by some servers, like IIS. This
despite it being a RFC voilation.

The parsing code would consider the method fully parsed on the first
space it encountered, even if that was the first character of the line.
This leads to the method always being empty, the actual method then
being parsed as the uri, the uri as the http version. In case of IIS
this can be used to evade detection.

This patch first skips past leading whitespaces, and ignores it when
interpreting the method. It does issue a warning log message, so
libhtp users can be notified of the anomaly.
Per personality requestline leading whitespace handling

Make handling of leading whitespace on the request line personality
aware. In the case of IDS and the various IIS versions, warn on the
whitespace but otherwise ignore it.

On Apache2, include the whitespace in the method and set the expected
400 response code.