htud->boundary_len = (uint8_t)boundary_len;
memcpy(htud->boundary, boundary, boundary_len);
- htud->flags |= HTP_BOUNDARY_SET;
+ htud->tsflags |= HTP_BOUNDARY_SET;
} else {
SCLogDebug("invalid boundary");
return -1;
expected_boundary_end, expected_boundary_end_len);
/* if we're in the file storage process, deal with that now */
- if (htud->flags & HTP_FILENAME_SET) {
- if (header_start != NULL || form_end != NULL || htud->flags & HTP_REQ_BODY_COMPLETE) {
+ if (htud->tsflags & HTP_FILENAME_SET) {
+ if (header_start != NULL || form_end != NULL || htud->tsflags & HTP_REQ_BODY_COMPLETE) {
SCLogDebug("reached the end of the file");
uint8_t *filedata = chunks_buffer;
filedata_len = form_end - filedata;
} else if (form_end != NULL && form_end == header_start) {
filedata_len = form_end - filedata - 2; /* 0d 0a */
- } else if (htud->flags & HTP_REQ_BODY_COMPLETE) {
+ } else if (htud->tsflags & HTP_REQ_BODY_COMPLETE) {
filedata_len = chunks_buffer_len;
flags = FILE_TRUNCATED;
}
PrintRawDataFp(stdout, filedata, filedata_len);
printf("FILEDATA (final chunk) END: \n");
#endif
- if (!(htud->flags & HTP_DONTSTORE)) {
+ if (!(htud->tsflags & HTP_DONTSTORE)) {
if (HTPFileClose(hstate, filedata, filedata_len, flags,
STREAM_TOSERVER) == -1)
{
}
}
- htud->flags &=~ HTP_FILENAME_SET;
+ htud->tsflags &=~ HTP_FILENAME_SET;
/* fall through */
} else {
printf("FILEDATA (part) END: \n");
#endif
- if (!(htud->flags & HTP_DONTSTORE)) {
+ if (!(htud->tsflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, filedata,
filedata_len, STREAM_TOSERVER);
if (result == -1) {
goto end;
} else if (result == -2) {
/* we know for sure we're not storing the file */
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
}
}
SCLogDebug("we have a filename");
- htud->flags |= HTP_FILENAME_SET;
- htud->flags &= ~HTP_DONTSTORE;
+ htud->tsflags |= HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_DONTSTORE;
SCLogDebug("header_end %p", header_end);
SCLogDebug("form_end %p", form_end);
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
} else {
if (HTPFileClose(hstate, NULL, 0, 0, STREAM_TOSERVER) == -1) {
goto end;
}
htud->request_body.body_parsed += (header_end - chunks_buffer);
- htud->flags &= ~HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_FILENAME_SET;
} else {
SCLogDebug("chunk doesn't contain form end");
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
}
} else {
filedata_len = header_next - filedata - 2;
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
} else {
if (HTPFileClose(hstate, NULL, 0, 0, STREAM_TOSERVER) == -1) {
goto end;
}
}
- htud->flags &= ~HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_FILENAME_SET;
htud->request_body.body_parsed += (header_end - chunks_buffer);
}
}
int result = 0;
/* see if we need to open the file */
- if (!(htud->flags & HTP_FILENAME_SET))
+ if (!(htud->tsflags & HTP_FILENAME_SET))
{
uint8_t *filename = NULL;
size_t filename_len = 0;
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
} else {
- htud->flags |= HTP_FILENAME_SET;
- htud->flags &= ~HTP_DONTSTORE;
+ htud->tsflags |= HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_DONTSTORE;
}
}
}
{
/* otherwise, just store the data */
- if (!(htud->flags & HTP_DONTSTORE)) {
+ if (!(htud->tsflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, data, data_len, STREAM_TOSERVER);
if (result == -1) {
goto end;
} else if (result == -2) {
/* we know for sure we're not storing the file */
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
}
}
}
int result = 0;
/* see if we need to open the file */
- if (!(htud->flags & HTP_FILENAME_SET))
+ if (!(htud->tsflags & HTP_FILENAME_SET))
{
uint8_t *filename = NULL;
size_t filename_len = 0;
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
} else {
- htud->flags |= HTP_FILENAME_SET;
- htud->flags &= ~HTP_DONTSTORE;
+ htud->tsflags |= HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_DONTSTORE;
}
}
}
{
/* otherwise, just store the data */
- if (!(htud->flags & HTP_DONTSTORE)) {
+ if (!(htud->tsflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, data, data_len, STREAM_TOSERVER);
if (result == -1) {
goto end;
} else if (result == -2) {
/* we know for sure we're not storing the file */
- htud->flags |= HTP_DONTSTORE;
+ htud->tsflags |= HTP_DONTSTORE;
}
}
}
int result = 0;
/* see if we need to open the file */
- if (!(htud->flags & HTP_FILENAME_SET))
+ if (!(htud->tcflags & HTP_FILENAME_SET))
{
SCLogDebug("setting up file name");
if (result == -1) {
goto end;
} else if (result == -2) {
- htud->flags |= HTP_DONTSTORE;
+ htud->tcflags |= HTP_DONTSTORE;
} else {
- htud->flags |= HTP_FILENAME_SET;
- htud->flags &= ~HTP_DONTSTORE;
+ htud->tcflags |= HTP_FILENAME_SET;
+ htud->tcflags &= ~HTP_DONTSTORE;
}
}
}
{
/* otherwise, just store the data */
- if (!(htud->flags & HTP_DONTSTORE)) {
+ if (!(htud->tcflags & HTP_DONTSTORE)) {
result = HTPFileStoreChunk(hstate, data, data_len, STREAM_TOCLIENT);
SCLogDebug("result %d", result);
if (result == -1) {
goto end;
} else if (result == -2) {
/* we know for sure we're not storing the file */
- htud->flags |= HTP_DONTSTORE;
+ htud->tcflags |= HTP_DONTSTORE;
}
}
}
int r = HtpBodyAppendChunk(htud, &htud->request_body, (uint8_t *)d->data, len);
if (r < 0) {
- htud->flags |= HTP_REQ_BODY_COMPLETE;
+ htud->tsflags |= HTP_REQ_BODY_COMPLETE;
} else if (hstate->request_body_limit > 0 &&
htud->request_body.content_len_so_far >= hstate->request_body_limit)
{
- htud->flags |= HTP_REQ_BODY_COMPLETE;
+ htud->tsflags |= HTP_REQ_BODY_COMPLETE;
} else if (htud->request_body.content_len_so_far == htud->request_body.content_len) {
- htud->flags |= HTP_REQ_BODY_COMPLETE;
+ htud->tsflags |= HTP_REQ_BODY_COMPLETE;
}
uint8_t *chunks_buffer = NULL;
if (htud->request_body_type == HTP_BODY_REQUEST_MULTIPART) {
/* multi-part body handling starts here */
- if (!(htud->flags & HTP_BOUNDARY_SET)) {
+ if (!(htud->tsflags & HTP_BOUNDARY_SET)) {
goto end;
}
int r = HtpBodyAppendChunk(htud, &htud->response_body, (uint8_t *)d->data, len);
if (r < 0) {
- htud->flags |= HTP_RES_BODY_COMPLETE;
+ htud->tcflags |= HTP_RES_BODY_COMPLETE;
} else if (hstate->response_body_limit > 0 &&
htud->response_body.content_len_so_far >= hstate->response_body_limit)
{
- htud->flags |= HTP_RES_BODY_COMPLETE;
+ htud->tcflags |= HTP_RES_BODY_COMPLETE;
} else if (htud->response_body.content_len_so_far == htud->response_body.content_len) {
- htud->flags |= HTP_RES_BODY_COMPLETE;
+ htud->tcflags |= HTP_RES_BODY_COMPLETE;
}
HtpResponseBodyHandle(hstate, htud, d->tx, (uint8_t *)d->data, (uint32_t)d->len);
if (connp->in_tx != NULL) {
HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(connp->in_tx);
if (htud != NULL) {
- if (htud->flags & HTP_FILENAME_SET) {
+ if (htud->tsflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, NULL, 0, 0, STREAM_TOSERVER);
- htud->flags &= ~HTP_FILENAME_SET;
+ htud->tsflags &= ~HTP_FILENAME_SET;
}
}
}
if (connp->out_tx != NULL) {
HtpTxUserData *htud = (HtpTxUserData *) htp_tx_get_user_data(connp->out_tx);
if (htud != NULL) {
- if (htud->flags & HTP_FILENAME_SET) {
+ if (htud->tcflags & HTP_FILENAME_SET) {
SCLogDebug("closing file that was being stored");
(void)HTPFileClose(hstate, NULL, 0, 0, STREAM_TOCLIENT);
- htud->flags &= ~HTP_FILENAME_SET;
+ htud->tcflags &= ~HTP_FILENAME_SET;
}
}
}