forked from premiere/premiere-libtorrent
improve error message for tracker_error_alert. various smaller attempts at making the unit tests more reliable
This commit is contained in:
parent
e94df810cb
commit
d45d193811
|
@ -151,9 +151,12 @@ namespace libtorrent {
|
||||||
std::string tracker_error_alert::message() const
|
std::string tracker_error_alert::message() const
|
||||||
{
|
{
|
||||||
char ret[400];
|
char ret[400];
|
||||||
|
std::string error_message;
|
||||||
|
if (error) error_message = error.message();
|
||||||
|
else error_message = msg;
|
||||||
snprintf(ret, sizeof(ret), "%s (%d) %s (%d)"
|
snprintf(ret, sizeof(ret), "%s (%d) %s (%d)"
|
||||||
, tracker_alert::message().c_str(), status_code
|
, tracker_alert::message().c_str(), status_code
|
||||||
, msg.c_str(), times_in_row);
|
, error_message.c_str(), times_in_row);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,11 @@ class ConnectionHandler:
|
||||||
'DELETE', 'TRACE'):
|
'DELETE', 'TRACE'):
|
||||||
self.method_others()
|
self.method_others()
|
||||||
except:
|
except:
|
||||||
|
try:
|
||||||
self.client.send(HTTPVER+' 502 Connection failed\n'+
|
self.client.send(HTTPVER+' 502 Connection failed\n'+
|
||||||
'Proxy-agent: %s\n\n'%VERSION)
|
'Proxy-agent: %s\n\n'%VERSION)
|
||||||
|
except Exception, e:
|
||||||
|
print e
|
||||||
self.client.close()
|
self.client.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ void web_server_thread(int* port, bool ssl, bool chunked)
|
||||||
path = path.substr(1);
|
path = path.substr(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "%s: [HTTP] %s\n", time_now_string(), path.c_str());
|
// fprintf(stderr, "%s: [HTTP] %s\n", time_now_string(), path.c_str());
|
||||||
|
|
||||||
if (path == "redirect")
|
if (path == "redirect")
|
||||||
{
|
{
|
||||||
|
@ -1418,7 +1418,7 @@ void web_server_thread(int* port, bool ssl, bool chunked)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fprintf(stderr, ">> serving file %s\n", path.c_str());
|
DLOG(stderr, ">> serving file %s\n", path.c_str());
|
||||||
error_code ec;
|
error_code ec;
|
||||||
int res = load_file(path, file_buf, ec, 8000000);
|
int res = load_file(path, file_buf, ec, 8000000);
|
||||||
if (res == -1)
|
if (res == -1)
|
||||||
|
@ -1458,11 +1458,11 @@ void web_server_thread(int* port, bool ssl, bool chunked)
|
||||||
extra_header[1] = eh;
|
extra_header[1] = eh;
|
||||||
if (end - start + 1 >= 1000)
|
if (end - start + 1 >= 1000)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "request size: %.2f kB\n", int(end - start + 1)/1000.f);
|
DLOG(stderr, "request size: %.2f kB\n", int(end - start + 1)/1000.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "request size: %d Bytes\n", int(end - start + 1));
|
DLOG(stderr, "request size: %d Bytes\n", int(end - start + 1));
|
||||||
}
|
}
|
||||||
send_response(s, ec, 206, "Partial", extra_header, end - start + 1);
|
send_response(s, ec, 206, "Partial", extra_header, end - start + 1);
|
||||||
if (!file_buf.empty())
|
if (!file_buf.empty())
|
||||||
|
|
Loading…
Reference in New Issue