diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-14 05:18:44 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-14 05:56:46 +0200 |
commit | b1c66ff90d7ea15f5667afec1658f395c5465e28 (patch) | |
tree | 0d24d39b1a2b698d385cd4143ab7a9cf4244b60e /src | |
parent | fix errors (diff) | |
download | mds-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 'src')
-rw-r--r-- | src/libmdsserver/mds-message.c | 9 |
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. */ |