aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-14 05:18:44 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-14 05:56:46 +0200
commitb1c66ff90d7ea15f5667afec1658f395c5465e28 (patch)
tree0d24d39b1a2b698d385cd4143ab7a9cf4244b60e /src
parentfix errors (diff)
downloadmds-b1c66ff90d7ea15f5667afec1658f395c5465e28.tar.gz
mds-b1c66ff90d7ea15f5667afec1658f395c5465e28.tar.bz2
mds-b1c66ff90d7ea15f5667afec1658f395c5465e28.tar.xz
m fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/libmdsserver/mds-message.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c
index dcb8986..b324ad4 100644
--- a/src/libmdsserver/mds-message.c
+++ b/src/libmdsserver/mds-message.c
@@ -120,7 +120,7 @@ int mds_message_read(mds_message_t* restrict this, int fd)
char* header;
/* We have found an empty line, i.e. the end of the headers.*/
- if (len == 0)
+ if (len == 1)
{
/* Remove the \n (end of empty line) we found from the buffer. */
memmove(this->buffer, this->buffer + 1, this->buffer_ptr -= 1);
@@ -162,7 +162,7 @@ int mds_message_read(mds_message_t* restrict this, int fd)
if (header_commit_buffer == 0)
{
header_commit_buffer = 8;
- if (this->headers == NULL)
+ if (this->header_count == 0)
{
if (xmalloc(this->headers, header_commit_buffer, char*))
return -1;
@@ -211,6 +211,11 @@ int mds_message_read(mds_message_t* restrict this, int fd)
}
/* Stage 1: payload. */
+ if ((this->stage == 1) && (this->payload_ptr == 0))
+ {
+ this->stage = 2;
+ return 0;
+ }
if ((this->stage == 1) && (this->payload_ptr > 0))
{
/* How much of the payload that has not yet been filled. */