Ticket URL: <
http://trac.wxwidgets.org/ticket/14336#comment:10>
#14336: wxHTTP::Connect() doesn't really open connection to the server
------------------------------+---------------------------------------------
Reporter: Silverstorm82 | Owner:
Type: defect | Status: confirmed
Priority: low | Milestone:
Component: network | Version: 2.9-svn
Keywords: wxHTPP localhost | Blockedby:
Patch: 0 | Blocking:
------------------------------+---------------------------------------------
Comment(by Kry):
Then I suggest changing
{{{
virtual bool Connect (const wxString &host)
virtual bool Connect (const wxString &host, unsigned short port)
}}}
to
{{{
virtual bool Connect (const wxString &host, unsigned short port = 0,
bool wait = true)
}}}
As I don't see the point for the two overloads, and we'll need to add the
wait parameter (currently unused in virtual bool Connect(const
wxSockAddress& addr, bool wait); )
Port 0 means for the Connect() function to choose the http port, we could
also make it default to 80 but 0 triggers else branch the following code:
{{{
if ( port )
addr->Service(port);
else if (!addr->Service(wxT("http")))
addr->Service(80);
}}}
which somehow looks like there's a point to it, even if I can't see it
(it's not like Service(wxT("http")) is ever going to be other than 80).
Once this change is made, I can modify
{{{
bool wxHTTP::Connect(const wxSockAddress& addr, bool WXUNUSED(wait))
}}}
to actually call the wxSocketClient part for either busy connection (with
wait == true) or the asynchronous one. And of course modify GetInputStream
properly.
If this seems like a good solution, I'll write and document it.
--
Ticket URL: <
http://trac.wxwidgets.org/ticket/14336#comment:10>