Byte string handling for http.py and test fixes

Few changes to http.py to account different use cases. Also fixed remaining test fails.