Fix some bugs in http.