Further robustness improvements

- Sometimes key is partially truncated (like  key=Reference<app='foobard', path=Path<....>>. Handle this gracefully
- When running tests we don't have "SERVER_SOFTWARE" in the environment. Handle it gracefully
- Sometimes the query string comes back as unicode (even though it doesn't contain unicode chars ???), but headers only support ascii
- Don't add truncation markers ('...') to the structures (list / dicts) to avoid confusing code in cleanup