Improve http filename parsing.

remotes/origin/master
Victor Julien 14 years ago
parent e237841a8e
commit e3935a2af2

@ -1559,6 +1559,7 @@ static int HtpRequestBodyHandlePOST(HtpState *hstate, HtpTxUserData *htud,
filename_len = bstr_len(tx->parsed_uri->path);
}
if (filename != NULL) {
result = HTPFileOpen(hstate, filename, filename_len, data, data_len,
hstate->transaction_cnt, STREAM_TOSERVER);
if (result == -1) {
@ -1570,6 +1571,7 @@ static int HtpRequestBodyHandlePOST(HtpState *hstate, HtpTxUserData *htud,
htud->flags &= ~HTP_DONTSTORE;
}
}
}
else
{
/* otherwise, just store the data */
@ -1610,6 +1612,7 @@ static int HtpRequestBodyHandlePUT(HtpState *hstate, HtpTxUserData *htud,
filename_len = bstr_len(tx->parsed_uri->path);
}
if (filename != NULL) {
result = HTPFileOpen(hstate, filename, filename_len, data, data_len,
hstate->transaction_cnt, STREAM_TOSERVER);
if (result == -1) {
@ -1621,6 +1624,7 @@ static int HtpRequestBodyHandlePUT(HtpState *hstate, HtpTxUserData *htud,
htud->flags &= ~HTP_DONTSTORE;
}
}
}
else
{
/* otherwise, just store the data */
@ -1674,6 +1678,7 @@ int HtpResponseBodyHandle(HtpState *hstate, HtpTxUserData *htud,
}
}
if (filename != NULL) {
result = HTPFileOpen(hstate, filename, filename_len,
data, data_len, hstate->transaction_cnt, STREAM_TOCLIENT);
SCLogDebug("result %d", result);
@ -1686,6 +1691,7 @@ int HtpResponseBodyHandle(HtpState *hstate, HtpTxUserData *htud,
htud->flags &= ~HTP_DONTSTORE;
}
}
}
else
{
/* otherwise, just store the data */

@ -332,7 +332,7 @@ static void FileFree(File *ff) {
}
void FileContainerAdd(FileContainer *ffc, File *ff) {
if (ffc->head == NULL) {
if (ffc->head == NULL || ffc->tail == NULL) {
ffc->head = ffc->tail = ff;
} else {
ffc->tail->next = ff;
@ -358,6 +358,7 @@ int FileStore(File *ff) {
*/
int FileSetTx(File *ff, uint16_t txid) {
SCLogDebug("ff %p txid %"PRIu16, ff, txid);
if (ff != NULL)
ff->txid = txid;
SCReturnInt(0);
}

Loading…
Cancel
Save