* Added a small wxHTTP description

* Added some example/description to wxFTP
* Some more on wxURL

* Added missing file in wxMMedia


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux
1999-02-25 20:13:10 +00:00
parent 623e1cb209
commit 9a1b2c283e
8 changed files with 174 additions and 4 deletions

View File

@@ -249,9 +249,11 @@ bool wxFTP::RmFile(const wxString& path)
class wxInputFTPStream : public wxSocketInputStream {
public:
wxFTP *m_ftp;
size_t m_ftpsize;
wxInputFTPStream(wxFTP *ftp_clt, wxSocketBase *sock)
: wxSocketInputStream(*sock), m_ftp(ftp_clt) {}
size_t StreamSize() { return m_ftpsize; }
virtual ~wxInputFTPStream(void)
{
if (LastError() != wxStream_NOERROR)
@@ -328,6 +330,8 @@ bool wxFTP::Abort(void)
wxInputStream *wxFTP::GetInputStream(const wxString& path)
{
wxString tmp_str;
int pos_size;
wxInputFTPStream *in_stream;
if (!SendCommand("TYPE I", '2'))
return NULL;
@@ -343,7 +347,16 @@ wxInputStream *wxFTP::GetInputStream(const wxString& path)
if (!SendCommand(tmp_str, '1'))
return NULL;
return new wxInputFTPStream(this, sock);
in_stream = new wxInputFTPStream(this, sock);
pos_size = m_lastResult.Index('(');
if (pos_size != wxNOT_FOUND) {
wxString str_size = m_lastResult(pos_size, m_lastResult.Index(')'));
in_stream->m_ftpsize = atoi(WXSTRINGCAST str_size);
}
return in_stream;
}
wxOutputStream *wxFTP::GetOutputStream(const wxString& path)

View File

@@ -231,7 +231,10 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
class wxHTTPStream : public wxSocketInputStream {
public:
wxHTTP *m_http;
size_t m_httpsize;
wxHTTPStream(wxHTTP *http) : wxSocketInputStream(*http), m_http(http) {}
size_t StreamSize() { return m_httpsize; }
virtual ~wxHTTPStream(void) { m_http->Abort(); }
};
@@ -255,5 +258,8 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path)
if (!BuildRequest(path, wxHTTP_GET))
return NULL;
if (GetHeader("Content-Length").IsEmpty())
inp_stream->m_httpsize = atoi(WXSTRINGCAST GetHeader("Content-Length"));
return inp_stream;
}