Added wxInternetFilesystemModule to fs_inet.cpp
Fixed PROXY support in wxURL, wxHTTP. You can set the environement variable HTTP_PROXY now. Fixed parsing of content type in wxHtmlFilter Added commments to gsocket.c wxURL parses the URL only once now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3180 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -274,26 +274,31 @@ void MyFrame::OnExecTest1(wxCommandEvent& WXUNUSED(evt))
|
||||
void MyFrame::Download(wxInputStream *input)
|
||||
{
|
||||
wxProgressDialog progress("Downloading ...", "0% downloaded");
|
||||
wxBufferedInputStream buf_in(*input);
|
||||
wxFileOutputStream f_out("test.url");
|
||||
|
||||
size_t file_size = input->StreamSize();
|
||||
size_t downloaded;
|
||||
int BUFSIZE = (file_size > 100) ? (file_size / 100) : file_size;
|
||||
int bytes_read = BUFSIZE;
|
||||
int BUFSIZE, bytes_read;
|
||||
size_t file_size;
|
||||
wxString message;
|
||||
int percents;
|
||||
|
||||
char *buf;
|
||||
|
||||
// TODO: Support for streams which don't support StreamSize
|
||||
|
||||
if (input->GetSize() == (size_t)-1) {
|
||||
file_size = (size_t)-1;
|
||||
bytes_read = BUFSIZE = 10240;
|
||||
} else {
|
||||
file_size = input->GetSize();
|
||||
if (file_size > 10240)
|
||||
bytes_read = BUFSIZE = file_size / 1024;
|
||||
else
|
||||
bytes_read = BUFSIZE = 1024;
|
||||
}
|
||||
buf = new char[BUFSIZE];
|
||||
|
||||
downloaded = 0;
|
||||
bytes_read = BUFSIZE;
|
||||
while (downloaded < file_size && bytes_read != 0) {
|
||||
bytes_read = buf_in.Read(buf, BUFSIZE).LastRead();
|
||||
bytes_read = input->Read(buf, BUFSIZE).LastRead();
|
||||
f_out.Write(buf, bytes_read);
|
||||
downloaded += bytes_read;
|
||||
|
||||
|
@@ -108,8 +108,8 @@ void MyFrame::OnSockRequest(wxSocketEvent& evt)
|
||||
|
||||
wxSocketBase *sock = evt.Socket();
|
||||
|
||||
printf("OnSockRequest OK\n");
|
||||
printf("OnSockRequest (event = %d)\n",evt.SocketEvent());
|
||||
wxPrintf(_T("OnSockRequest OK\n"));
|
||||
wxPrintf(_T("OnSockRequest (event = %d)\n"),evt.SocketEvent());
|
||||
switch (evt.SocketEvent()) {
|
||||
case GSOCK_INPUT:
|
||||
unsigned char c;
|
||||
@@ -120,13 +120,15 @@ void MyFrame::OnSockRequest(wxSocketEvent& evt)
|
||||
|
||||
break;
|
||||
case GSOCK_LOST:
|
||||
printf("Destroying socket\n");
|
||||
wxPrintf(_T("Destroying socket\n"));
|
||||
wxPendingDelete.Append(sock);
|
||||
UpdateStatus(-1);
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
wxPrintf(_T("Invalid event !\n"));
|
||||
}
|
||||
printf("OnSockRequest Exiting\n");
|
||||
wxPrintf(_T("OnSockRequest Exiting\n"));
|
||||
}
|
||||
|
||||
void MyFrame::OnSockRequestServer(wxSocketEvent& evt)
|
||||
@@ -142,8 +144,8 @@ void MyFrame::OnSockRequestServer(wxSocketEvent& evt)
|
||||
wxSocketBase *sock2;
|
||||
wxSocketServer *server = (wxSocketServer *) evt.Socket();
|
||||
|
||||
printf("OnSockRequestServer OK\n");
|
||||
printf("OnSockRequest (Main = %d) (event = %d)\n",wxThread::IsMain(), evt.SocketEvent());
|
||||
wxPrintf(_T("OnSockRequestServer OK\n"));
|
||||
wxPrintf(_T("OnSockRequest (Main = %d) (event = %d)\n"),wxThread::IsMain(), evt.SocketEvent());
|
||||
|
||||
sock2 = server->Accept();
|
||||
if (sock2 == NULL)
|
||||
@@ -199,8 +201,8 @@ void MyFrame::ExecTest1(wxSocketBase *sock_o)
|
||||
|
||||
void MyFrame::UpdateStatus(int incr)
|
||||
{
|
||||
char s[30];
|
||||
wxChar s[30];
|
||||
nb_clients += incr;
|
||||
sprintf(s, "%d clients connected", nb_clients);
|
||||
wxSprintf(s, _T("%d clients connected"), nb_clients);
|
||||
SetStatusText(s);
|
||||
}
|
||||
|
Reference in New Issue
Block a user