aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/connection.c')
-rw-r--r--src/daemon/connection.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
index 4315a5bc..6da77002 100644
--- a/src/daemon/connection.c
+++ b/src/daemon/connection.c
@@ -1070,7 +1070,7 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
1070 /* prepare send buffer */ 1070 /* prepare send buffer */
1071 if ( (response->data == NULL) || 1071 if ( (response->data == NULL) ||
1072 (response->data_start > connection->messagePos) || 1072 (response->data_start > connection->messagePos) ||
1073 (response->data_start + response->data_size < connection->messagePos) ) { 1073 (response->data_start + response->data_size <= connection->messagePos) ) {
1074 if (response->data_size == 0) { 1074 if (response->data_size == 0) {
1075 if (response->data != NULL) 1075 if (response->data != NULL)
1076 free(response->data); 1076 free(response->data);
@@ -1080,8 +1080,8 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
1080 ret = response->crc(response->crc_cls, 1080 ret = response->crc(response->crc_cls,
1081 connection->messagePos, 1081 connection->messagePos,
1082 response->data, 1082 response->data,
1083 MAX(MHD_BUF_INC_SIZE, 1083 MIN(response->data_size,
1084 response->data_size - connection->messagePos)); 1084 response->total_size - connection->messagePos));
1085 if (ret == -1) { 1085 if (ret == -1) {
1086 /* end of message, signal other side by closing! */ 1086 /* end of message, signal other side by closing! */
1087 response->data_size = connection->messagePos; 1087 response->data_size = connection->messagePos;
@@ -1099,7 +1099,6 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
1099 return MHD_YES; 1099 return MHD_YES;
1100 } 1100 }
1101 } 1101 }
1102
1103 /* transmit */ 1102 /* transmit */
1104 ret = SEND(connection->socket_fd, 1103 ret = SEND(connection->socket_fd,
1105 &response->data[connection->messagePos - response->data_start], 1104 &response->data[connection->messagePos - response->data_start],
@@ -1118,9 +1117,9 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
1118 return MHD_YES; 1117 return MHD_YES;
1119 } 1118 }
1120 connection->messagePos += ret; 1119 connection->messagePos += ret;
1121 if (connection->messagePos > response->data_size) 1120 if (connection->messagePos > response->total_size)
1122 abort(); /* internal error */ 1121 abort(); /* internal error */
1123 if (connection->messagePos == response->data_size) { 1122 if (connection->messagePos == response->total_size) {
1124 if ( (connection->bodyReceived == 0) || 1123 if ( (connection->bodyReceived == 0) ||
1125 (connection->headersReceived == 0) ) 1124 (connection->headersReceived == 0) )
1126 abort(); /* internal error */ 1125 abort(); /* internal error */