00001
00002
00003
00004
00005
00006 #include "fsHttpConnection.h"
00007 #include "fsInternetSession.h"
00008
00009 fsHttpConnection::fsHttpConnection()
00010 {
00011
00012 }
00013
00014 fsHttpConnection::~fsHttpConnection()
00015 {
00016
00017 }
00018
00019 fsInternetResult fsHttpConnection::Connect(LPCSTR pszServer, LPCSTR pszUser, LPCSTR pszPassword, INTERNET_PORT nPort)
00020 {
00021 if (!m_pSession)
00022 return IR_NOTINITIALIZED;
00023
00024 HINTERNET hSession = m_pSession->GetHandle ();
00025
00026 if (!hSession)
00027 return IR_NOTINITIALIZED;
00028
00029 if (m_hServer)
00030 InternetCloseHandle (m_hServer);
00031
00032 m_hServer = InternetConnect (hSession, pszServer, nPort,
00033 pszUser, pszPassword, INTERNET_SERVICE_HTTP, 0, NULL);
00034
00035 if (!m_hServer)
00036 return fsWinInetErrorToIR ();
00037
00038 m_strServer = pszServer;
00039 m_uPort = nPort;
00040
00041 return IR_SUCCESS;
00042 }