stream: improve retransmission handling

Improve retransmission handling in the CLOSE_WAIT state.

Bug #1180.
json-file: check pointer before using

A check was missing to see if ht_ud was not null before using the
pointer. This should be rare, but it can happen.

Reported-by: Will Metcalf
json-file: improve error handling

If the functions getting uri, etc fail. Return "unknown" instead of
NULL pointer. This improves consistency.