lib: fix CONNECT request handling

Signed-off-by: Fedor Indutny <fedor@indutny.com>