|
|
|
@ -61,6 +61,8 @@ httpParserParse(void * _this, Stream st) |
|
|
|
} |
|
|
|
|
|
|
|
if (0 > (read = cbufRead(this->buffer, st))) { |
|
|
|
cbufRelease(this->buffer); |
|
|
|
this->ourLock = FALSE; |
|
|
|
return read; |
|
|
|
} |
|
|
|
|
|
|
|
@ -75,10 +77,9 @@ httpParserParse(void * _this, Stream st) |
|
|
|
cbufRelease(this->buffer); |
|
|
|
this->ourLock = FALSE; |
|
|
|
cont = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case HTTP_MESSAGE_START: |
|
|
|
if (NULL == (line = cbufGetLine(this->buffer, &line_end))) { |
|
|
|
if (! cbufIsEmpty(this->buffer)) { |
|
|
|
@ -98,17 +99,16 @@ httpParserParse(void * _this, Stream st) |
|
|
|
if (NULL == this->current) { |
|
|
|
cbufRelease(this->buffer); |
|
|
|
this->ourLock = FALSE; |
|
|
|
return -1; |
|
|
|
return -2; // a server error occured can't process... |
|
|
|
} |
|
|
|
httpParserRequestVars(this); |
|
|
|
|
|
|
|
this->state = HTTP_MESSAGE_INTRO_DONE; |
|
|
|
break; |
|
|
|
|
|
|
|
case HTTP_MESSAGE_INTRO_DONE: |
|
|
|
if (NULL == (line = cbufGetLine(this->buffer, &line_end))) { |
|
|
|
if (! cbufIsEmpty(this->buffer)) { |
|
|
|
this->isize = this->buffer->bused; |
|
|
|
this->isize = this->buffer->bused; |
|
|
|
this->incomplete = memMalloc(this->isize); |
|
|
|
memcpy(this->incomplete, |
|
|
|
cbufGetData(this->buffer, this->isize), |
|
|
|
@ -120,35 +120,34 @@ httpParserParse(void * _this, Stream st) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (0 == strlen(line)) { |
|
|
|
this->state = HTTP_MESSAGE_HEADERS_DONE; |
|
|
|
if (0 != strlen(line)) { |
|
|
|
httpParserHeader(this, line, line_end); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
httpParserHeader(this, line, line_end); |
|
|
|
break; |
|
|
|
this->state = HTTP_MESSAGE_HEADERS_DONE; |
|
|
|
|
|
|
|
case HTTP_MESSAGE_HEADERS_DONE: |
|
|
|
if (this->current->dbody == this->current->nbody) { |
|
|
|
this->state = HTTP_MESSAGE_DONE; |
|
|
|
break; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (cbufIsEmpty(this->buffer)) { |
|
|
|
cbufRelease(this->buffer); |
|
|
|
this->ourLock = FALSE; |
|
|
|
cont = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
cbufIncRead( |
|
|
|
this->buffer, |
|
|
|
httpParserBody( |
|
|
|
this, |
|
|
|
cbufGetRead(this->buffer), |
|
|
|
this->buffer->bused)); |
|
|
|
|
|
|
|
if (cbufIsEmpty(this->buffer)) { |
|
|
|
cbufRelease(this->buffer); |
|
|
|
this->ourLock = FALSE; |
|
|
|
cont = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
cbufIncRead( |
|
|
|
this->buffer, |
|
|
|
httpParserBody( |
|
|
|
this, |
|
|
|
cbufGetRead(this->buffer), |
|
|
|
this->buffer->bused)); |
|
|
|
break; |
|
|
|
|
|
|
|
case HTTP_MESSAGE_DONE: |
|
|
|
{ |
|
|
|
HttpHeader enc = hashGet( |
|
|
|
|