Merge pull request #2655 from Ryex/fix/json-parsing-validator-buffer-reset
fix(net/validators): ensure buffers are cleared and reset;
This commit is contained in:
commit
dcc58c8b75
@ -30,13 +30,21 @@ class ParsingValidator : public Net::Validator {
|
|||||||
virtual ~ParsingValidator() {};
|
virtual ~ParsingValidator() {};
|
||||||
|
|
||||||
public: /* methods */
|
public: /* methods */
|
||||||
bool init(QNetworkRequest&) override { return true; }
|
bool init(QNetworkRequest&) override
|
||||||
|
{
|
||||||
|
m_data.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
bool write(QByteArray& data) override
|
bool write(QByteArray& data) override
|
||||||
{
|
{
|
||||||
this->m_data.append(data);
|
this->m_data.append(data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool abort() override { return true; }
|
bool abort() override
|
||||||
|
{
|
||||||
|
m_data.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
bool validate(QNetworkReply&) override
|
bool validate(QNetworkReply&) override
|
||||||
{
|
{
|
||||||
auto fname = m_entity->localFilename();
|
auto fname = m_entity->localFilename();
|
||||||
|
@ -60,7 +60,11 @@ class ChecksumValidator : public Validator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto abort() -> bool override { return true; }
|
auto abort() -> bool override
|
||||||
|
{
|
||||||
|
m_checksum.reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
auto validate(QNetworkReply&) -> bool override
|
auto validate(QNetworkReply&) -> bool override
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user