Add logging of HttpProxy response.

GitOrigin-RevId: a7ad02206e0c6515d38a7f0b767735f25eb6c7c1
This commit is contained in:
levlam 2018-12-06 20:29:10 +03:00
parent 811d24f1ba
commit b777051eaa

View File

@ -7,6 +7,7 @@
#include "td/net/HttpProxy.h"
#include "td/utils/base64.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Slice.h"
@ -41,6 +42,10 @@ Status HttpProxy::wait_connect_response() {
it.advance(12, begin);
if ((begin.substr(0, 10) != "HTTP/1.1 2" && begin.substr(0, 10) != "HTTP/1.0 2") || !is_digit(begin[10]) ||
!is_digit(begin[11])) {
char buf[1024];
size_t len = min(sizeof(buf), it.size());
it.advance(len, MutableSlice{buf, sizeof(buf)});
VLOG(proxy) << "Failed to connect: " << format::escaped(Slice(buf, len));
return Status::Error("Failed to connect");
}