mirror of
https://github.com/aria2/aria2.git
synced 2025-01-24 02:31:29 +00:00
efbfe4c006
Data from remote server in HTTP/FTP download are now written to the disk(or memory) through StreamFilter. Decoding chunked and gziped streams are done cascading StreamFilter. Removed inefficient 1byte read code. * src/ChunkedDecodingStreamFilter.cc * src/ChunkedDecodingStreamFilter.h * src/DownloadCommand.cc * src/DownloadCommand.h * src/GZipDecodingStreamFilter.cc * src/GZipDecodingStreamFilter.h * src/HttpConnection.cc * src/HttpDownloadCommand.cc * src/HttpResponse.cc * src/HttpResponse.h * src/HttpResponseCommand.cc * src/HttpResponseCommand.h * src/HttpSkipResponseCommand.cc * src/HttpSkipResponseCommand.h * src/Makefile.am * src/NullSinkStreamFilter.cc * src/NullSinkStreamFilter.h * src/RequestGroup.cc * src/SinkStreamFilter.cc * src/SinkStreamFilter.h * src/StreamFilter.cc * src/StreamFilter.h * test/ChunkedDecodingStreamFilterTest.cc * test/GZipDecodingStreamFilterTest.cc * test/HttpResponseTest.cc * test/Makefile.am * test/MockSegment.h
81 lines
1.2 KiB
C++
81 lines
1.2 KiB
C++
#ifndef D_MOCK_SEGMENT_H
|
|
#define D_MOCK_SEGMENT_H
|
|
|
|
#include "Segment.h"
|
|
#include "Piece.h"
|
|
#include "A2STR.h"
|
|
|
|
namespace aria2 {
|
|
|
|
class MockSegment:public Segment {
|
|
public:
|
|
virtual bool complete() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual size_t getIndex() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual off_t getPosition() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual off_t getPositionToWrite() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual size_t getLength() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual size_t getSegmentLength() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual size_t getWrittenLength() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual void updateWrittenLength(size_t bytes) {}
|
|
|
|
#ifdef ENABLE_MESSAGE_DIGEST
|
|
|
|
// `begin' is a offset inside this segment.
|
|
virtual bool updateHash
|
|
(uint32_t begin, const unsigned char* data, size_t dataLength)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual bool isHashCalculated() const
|
|
{
|
|
return false;
|
|
}
|
|
|
|
virtual std::string getHashString()
|
|
{
|
|
return A2STR::NIL;
|
|
}
|
|
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
|
|
virtual void clear() {}
|
|
|
|
virtual SharedHandle<Piece> getPiece() const
|
|
{
|
|
return SharedHandle<Piece>();
|
|
}
|
|
};
|
|
|
|
} // namespace aria2
|
|
|
|
#endif // D_MOCK_SEGMENT_H
|