00001 // 00002 // UploadTransferHTTP.h 00003 // 00004 // Copyright (c) Shareaza Development Team, 2002-2005. 00005 // This file is part of SHAREAZA (www.shareaza.com) 00006 // 00007 // Shareaza is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // Shareaza is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Shareaza; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 00022 #if !defined(AFX_UPLOADTRANSFERHTTP_H__FFC5B664_6827_41EC_87E2_033318A36E0A__INCLUDED_) 00023 #define AFX_UPLOADTRANSFERHTTP_H__FFC5B664_6827_41EC_87E2_033318A36E0A__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "UploadTransfer.h" 00028 00029 class CLibraryFile; 00030 class CDownload; 00031 class CTigerTree; 00032 class CXMLElement; 00033 class CED2K; 00034 00035 00036 class CUploadTransferHTTP : public CUploadTransfer 00037 { 00038 // Construction 00039 public: 00040 CUploadTransferHTTP(); 00041 virtual ~CUploadTransferHTTP(); 00042 00043 // Attributes 00044 protected: 00045 CString m_sRequest; 00046 DWORD m_tRequest; 00047 BOOL m_bHead; 00048 BOOL m_bConnectHdr; 00049 BOOL m_bKeepAlive; 00050 BOOL m_bHostBrowse; 00051 BOOL m_bDeflate; 00052 BOOL m_bBackwards; 00053 BOOL m_bRange; 00054 BOOL m_bQueueMe; 00055 BOOL m_bNotShareaza; 00056 int m_nGnutella; 00057 int m_nReaskMultiplier; //Last re-ask time multiplier used 00058 protected: 00059 BOOL m_bTigerTree; 00060 BOOL m_bMetadata; 00061 CString m_sLocations; 00062 CString m_sRanges; 00063 00064 // Operations 00065 public: 00066 virtual void AttachTo(CConnection* pConnection); 00067 protected: 00068 BOOL ReadRequest(); 00069 BOOL RequestSharedFile(CLibraryFile* pFile, CSingleLock& oLibraryLock); 00070 BOOL RequestPartialFile(CDownload* pFile); 00071 BOOL RequestTigerTreeRaw(CTigerTree* pTigerTree, BOOL bDelete); 00072 BOOL RequestTigerTreeDIME(CTigerTree* pTigerTree, int nDepth, CED2K* pHashset, BOOL bDelete); 00073 BOOL RequestMetadata(CXMLElement* pMetadata); 00074 BOOL RequestPreview(CLibraryFile* pFile, CSingleLock& oLibraryLock); 00075 BOOL RequestHostBrowse(); 00076 protected: 00077 BOOL IsNetworkDisabled(); 00078 BOOL QueueRequest(); 00079 BOOL OpenFileSendHeaders(); 00080 void SendDefaultHeaders(); 00081 void SendFileHeaders(); 00082 void OnCompleted(); 00083 void SendResponse(UINT nResourceID, BOOL bFileHeaders = FALSE); 00084 void GetNeighbourList(CString& strOutput); 00085 protected: 00086 virtual BOOL OnRun(); 00087 virtual void OnDropped(BOOL bError); 00088 virtual BOOL OnRead(); 00089 virtual BOOL OnWrite(); 00090 virtual BOOL OnHeaderLine(CString& strHeader, CString& strValue); 00091 virtual BOOL OnHeadersComplete(); 00092 00093 public: 00094 inline BOOL IsBackwards() const { return m_bBackwards; } 00095 }; 00096 00097 #endif // !defined(AFX_UPLOADTRANSFERHTTP_H__FFC5B664_6827_41EC_87E2_033318A36E0A__INCLUDED_)