Пример #1
0
bool wxCurlFTPTool::GetFTPFs(wxArrayFTPFs& fs, const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	if(List(szRemoteLoc))
	{
        wxString str = wxCURL_BUF2STRING(m_szResponseBody);
		wxStringInputStream inStream(str);

		if(inStream.IsOk())
		{
			wxTextInputStream txtInStream(inStream);
			wxString szCurrentLine = txtInStream.ReadLine();

			while(!szCurrentLine.IsEmpty())
			{
				struct ftpparse ftppItem;

				wxCharBuffer charBuffer(szCurrentLine.ToUTF8());
				
				if(ftpparse(&ftppItem,charBuffer.data(), charBuffer.length()) != 0)
				{					
					fs.Add(wxCurlFTPFs((wxChar*)ftppItem.name, 
                            (ftppItem.flagtrycwd == 1),(ftppItem.flagtryretr == 1),
                                ftppItem.mtime,ftppItem.size));
				}

				szCurrentLine = txtInStream.ReadLine();
			}

			return true;
		}
	}

	return false;
}
Пример #2
0
bool wxCurlFTPTool::GetFTPFs(wxArrayFTPFs& fs, const wxString& szRemoteLoc /*= wxEmptyString*/)

{
    if(List(szRemoteLoc))
    {
        wxString str = wxCURL_BUF2STRING(m_szResponseBody);
        wxStringInputStream inStream(str);

        if(inStream.IsOk())
        {
            wxTextInputStream txtInStream(inStream);
            for(;;)
            {
                wxString szCurrentLine = txtInStream.ReadLine();
                if(szCurrentLine.empty())
                    break;

                wxCharBuffer buf(szCurrentLine.mb_str());

                struct ftpparse ftppItem;
                if(ftpparse(&ftppItem, buf.data(), strlen(buf)) != 0)
                {
                    fs.Add(wxCurlFTPFs(wxString(ftppItem.name, wxConvLibc),
                                       (ftppItem.flagtrycwd == 1),(ftppItem.flagtryretr == 1),
                                       ftppItem.mtime,ftppItem.size));
                }
            }

            return true;
        }
    }

    return false;
}
Пример #3
0
bool wxCurlDAVTool::GetDAVFs(wxArrayDAVFs& fs, const wxString& szRemoteLoc /*= wxEmptyString*/)
{
	wxArrayString arrProps;

	arrProps.Add(wxS("creationdate"));
	arrProps.Add(wxS("getlastmodified"));
	arrProps.Add(wxS("getcontentlength"));
	arrProps.Add(wxS("getcontenttype"));

	if(Propfind(arrProps, szRemoteLoc))
	{
		// Construct Input Source...
		wxStringInputStream inStream(wxCURL_BUF2STRING(m_szResponseBody));

		if(inStream.IsOk())
		{
			// Construct XML Parser
			wxXmlDocument xmlPropfind(inStream);

			if(xmlPropfind.IsOk())
			{
				// Process XML!
				wxXmlNode* pNode = xmlPropfind.GetRoot();

				// Strip Past First "Multistatus" tag...
				while(pNode)
				{
					if(pNode->GetName().Find(wxS("multistatus")) != -1)
					{
						pNode = pNode->GetChildren();
						break;
					}
					else
						pNode = pNode->GetNext();
				}
				
				// Process "Response" tags...
				while(pNode)
				{
					wxCurlDAVFs fsItem;

					wxString szName = pNode->GetName();

					if(pNode->GetName().Find(wxS("response")) != -1)
					{
						if(ParseResponseXml(fsItem, pNode))
							fs.Add(fsItem);
					}

					pNode = pNode->GetNext();
				}

				return true;
			}
		}
	}

	return false;
}
Пример #4
0
	size_t wxcurl_string_write(void* ptr, size_t size, size_t nmemb, void* pcharbuf)
	{
		size_t iRealSize = size * nmemb;
		wxCharBuffer* pStr = (wxCharBuffer*) pcharbuf;

		if(pStr)
		{
			wxString str = wxCURL_BUF2STRING(*pStr) + wxString((const char*)ptr, wxConvLibc);
			*pStr = wxCURL_STRING2BUF(str);
		}

		return iRealSize;
	}
Пример #5
0
wxString wxCurlHTTP::GetCookieFile() const
{
    return wxCURL_BUF2STRING(m_szCookieFile);
}
Пример #6
0
wxString wxCurlFTP::GetPortParam() const
{
	return wxCURL_BUF2STRING(m_szPortParam);
}