|
|
|
@ -37,15 +37,14 @@ ssize_t |
|
|
|
httpWriterWrite(void * _this, Stream st) |
|
|
|
{ |
|
|
|
HttpWriter this = _this; |
|
|
|
int cont = 1; |
|
|
|
|
|
|
|
while (cont) { |
|
|
|
switch (this->state) { |
|
|
|
char * start; |
|
|
|
ssize_t to_write; |
|
|
|
ssize_t written; |
|
|
|
|
|
|
|
case HTTP_WRITER_GET: |
|
|
|
|
|
|
|
if (! queueEmpty(this->queue)) { |
|
|
|
this->current = queueGet(this->queue); |
|
|
|
|
|
|
|
@ -82,11 +81,11 @@ httpWriterWrite(void * _this, Stream st) |
|
|
|
this->state = HTTP_WRITER_WRITE; |
|
|
|
} |
|
|
|
else { |
|
|
|
cont = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
case HTTP_WRITER_WRITE: |
|
|
|
|
|
|
|
if (this->written >= this->nbuffer) { |
|
|
|
size_t body_done = this->written - this->nheader; |
|
|
|
|
|
|
|
@ -117,7 +116,6 @@ httpWriterWrite(void * _this, Stream st) |
|
|
|
* By the way, the same is true for reading, |
|
|
|
* so to say, the parser. |
|
|
|
*/ |
|
|
|
cont = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
@ -129,6 +127,7 @@ httpWriterWrite(void * _this, Stream st) |
|
|
|
} |
|
|
|
|
|
|
|
case HTTP_WRITER_DONE: |
|
|
|
|
|
|
|
this->state = HTTP_WRITER_GET; |
|
|
|
|
|
|
|
if (! httpMessageHasKeepAlive(this->current)) { |
|
|
|
@ -139,13 +138,13 @@ httpWriterWrite(void * _this, Stream st) |
|
|
|
* underlying connection should be closed at their side. |
|
|
|
* Then we close to connection. |
|
|
|
*/ |
|
|
|
delete(this->current); |
|
|
|
return -2; |
|
|
|
} |
|
|
|
delete(this->current); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return NULL == this->current ? |
|
|
|
this->queue->nmsg : |
|
|
|
|