Fix bad response to malformed URIs

Tests revealed a bug when users provided a bad request URI. Rather than
just severing the socket connection this returns an HTTP 400 response
for anything not recognized and then closes the connection cleanly.

BugzId: 27664