- if (GetHeader("Content-Length").IsEmpty())
- inp_stream->m_httpsize = atoi(WXSTRINGCAST GetHeader("Content-Length"));
+ inp_stream = new wxHTTPStream(this);
+
+ if (!GetHeader(wxT("Content-Length")).IsEmpty())
+ inp_stream->m_httpsize = wxAtoi(WXSTRINGCAST GetHeader(wxT("Content-Length")));
+ else
+ inp_stream->m_httpsize = (size_t)-1;
+
+ inp_stream->m_read_bytes = 0;
+
+ Notify(FALSE);
+ SetFlags(wxSOCKET_BLOCK | wxSOCKET_WAITALL);