void HttpGetSocket::OnConnect() { SetMethod( "GET" ); AddResponseHeader( "Accept", "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1"); AddResponseHeader( "Accept-Language", "en-us,en;q=0.5"); AddResponseHeader( "Accept-Encoding", "gzip,deflate"); AddResponseHeader( "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); AddResponseHeader( "User-agent", MyUseragent() ); if (GetUrlPort() != 80 && GetUrlPort() != 443) AddResponseHeader( "Host", GetUrlHost() + ":" + Utility::l2string(GetUrlPort()) ); else AddResponseHeader( "Host", GetUrlHost() ); SendRequest(); }
void HttpClientSocket::Url(const std::string& url_in,std::string& host,port_t& port) { std::string url; url_this(url_in, m_protocol, m_host, m_port, url, m_url_filename); SetUrl(url); host = GetUrlHost(); port = GetUrlPort(); }
HttpGetSocket::HttpGetSocket(ISocketHandler& h,const std::string& url_in,const std::string& to_file) : HttpClientSocket(h, url_in) { if (to_file.size()) { SetFilename(to_file); } if (!Open(GetUrlHost(),GetUrlPort())) { if (!Connecting()) { Handler().LogError(this, "HttpGetSocket", -1, "connect() failed miserably", LOG_LEVEL_FATAL); SetCloseAndDelete(); } } }
void HttpPostSocket::Open() { // why do I have to specify TcpSocket:: to get to the Open() method?? TcpSocket::Open(GetUrlHost(), GetUrlPort()); }
void HttpGetSocket::DoConnect() { DoConnect(GetUrlHost(), GetUrlPort()); }