2
* This file is part of nzbget
4
* Copyright (C) 2012 Andrey Prygunkov <hugbug@users.sourceforge.net>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* $Date: 2012-08-06 22:32:48 +0200 (Mon, 06 Aug 2012) $
26
#ifndef WEBDOWNLOADER_H
27
#define WEBDOWNLOADER_H
33
#include "Connection.h"
36
class WebDownloader : public Thread, public Subject
53
char* m_szOutputFilename;
54
Connection* m_pConnection;
55
Mutex m_mutexConnection;
57
time_t m_tLastUpdateTime;
61
bool m_bConfirmedLength;
62
char* m_szOriginalFilename;
65
GUnzipStream* m_pGUnzipStream;
68
void SetStatus(EStatus eStatus);
69
bool Write(void* pBuffer, int iLen);
71
void FreeConnection();
72
EStatus CheckResponse(const char* szResponse);
74
EStatus CreateConnection(URL *pUrl);
75
void ParseFilename(const char* szContentDisposition);
76
void SendHeaders(URL *pUrl);
77
EStatus DownloadHeaders();
78
EStatus DownloadBody();
81
virtual void ProcessHeader(const char* szLine);
86
EStatus GetStatus() { return m_eStatus; }
90
void SetInfoName(const char* v);
91
const char* GetInfoName() { return m_szInfoName; }
92
void SetURL(const char* szURL);
93
const char* GetOutputFilename() { return m_szOutputFilename; }
94
void SetOutputFilename(const char* v);
95
time_t GetLastUpdateTime() { return m_tLastUpdateTime; }
96
void SetLastUpdateTimeNow() { m_tLastUpdateTime = ::time(NULL); }
97
bool GetConfirmedLength() { return m_bConfirmedLength; }
98
const char* GetOriginalFilename() { return m_szOriginalFilename; }