mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 21:22:31 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a075001a73 | |||
| 781520fef8 |
+2
-5
@@ -258,11 +258,8 @@ JsonRpc::process(const char* in_buffer, uint32_t length, slot_write callback) {
|
|||||||
|
|
||||||
return callback(response_str.c_str(), response_str.size());
|
return callback(response_str.c_str(), response_str.size());
|
||||||
|
|
||||||
} catch (json::parse_error& e) {
|
} catch (json::exception& e) {
|
||||||
auto err_str = json_error(JSONRPC_PARSE_ERROR, e.what(), nullptr).dump(-1, ' ', false, json::error_handler_t::replace);
|
// Exception strings may contain invalid UTF-8, hence the ::replace
|
||||||
return callback(err_str.c_str(), err_str.size());
|
|
||||||
} catch (json::type_error& e) {
|
|
||||||
// Type errors may be caused by invalid UTF-8 strings in exception strings, hence the ::replace
|
|
||||||
auto err_str = json_error(JSONRPC_PARSE_ERROR, e.what(), nullptr).dump(-1, ' ', false, json::error_handler_t::replace);
|
auto err_str = json_error(JSONRPC_PARSE_ERROR, e.what(), nullptr).dump(-1, ' ', false, json::error_handler_t::replace);
|
||||||
return callback(err_str.c_str(), err_str.size());
|
return callback(err_str.c_str(), err_str.size());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,12 @@ SCgiTask::event_read() {
|
|||||||
if (m_content_length == 0)
|
if (m_content_length == 0)
|
||||||
read_length--;
|
read_length--;
|
||||||
|
|
||||||
if (read_length <= 0)
|
if (read_length <= 0) {
|
||||||
|
if (m_content_length == 0)
|
||||||
|
return close();
|
||||||
|
|
||||||
throw torrent::internal_error("SCgiTask::event_read() no space in buffer for event_read.");
|
throw torrent::internal_error("SCgiTask::event_read() no space in buffer for event_read.");
|
||||||
|
}
|
||||||
|
|
||||||
int bytes = ::recv(file_descriptor(), m_buffer.data() + m_position, read_length, 0);
|
int bytes = ::recv(file_descriptor(), m_buffer.data() + m_position, read_length, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user