web_connection_base::web_connection_base( peer_connection_args const& pack , web_seed_t& web) : peer_connection(pack) , m_first_request(true) , m_ssl(false) , m_external_auth(web.auth) , m_extra_headers(web.extra_headers) , m_parser(http_parser::dont_parse_chunks) , m_body_start(0) { TORRENT_ASSERT(&web.peer_info == pack.peerinfo); // when going through a proxy, we don't necessarily have an endpoint here, // since the proxy might be resolving the hostname, not us TORRENT_ASSERT(web.endpoints.empty() || web.endpoints.front() == pack.endp); INVARIANT_CHECK; TORRENT_ASSERT(is_outgoing()); // we only want left-over bandwidth // TODO: introduce a web-seed default class which has a low download priority std::string protocol; error_code ec; boost::tie(protocol, m_basic_auth, m_host, m_port, m_path) = parse_url_components(web.url, ec); TORRENT_ASSERT(!ec); if (m_port == -1 && protocol == "http") m_port = 80; #ifdef TORRENT_USE_OPENSSL if (protocol == "https") { m_ssl = true; if (m_port == -1) m_port = 443; } #endif if (!m_basic_auth.empty()) m_basic_auth = base64encode(m_basic_auth); m_server_string = "URL seed @ "; m_server_string += m_host; }
/** * \brief Control request event handler * * This implementation handles the control requests for the GuiderPort device */ void EVENT_USB_Device_ControlRequest() { if (is_control()) { if (is_incoming()) { switch (USB_ControlRequest.bRequest) { case FOCUSER_RESET: process_reset(); break; case FOCUSER_SET: process_set(); break; case FOCUSER_LOCK: process_lock(); break; case FOCUSER_STOP: process_stop(); break; case FOCUSER_SERIAL: process_serial(); break; } } if (is_outgoing()) { switch (USB_ControlRequest.bRequest) { case FOCUSER_GET: process_get(); break; case FOCUSER_RCVR: process_rcvr(); break; case FOCUSER_SAVED: process_saved(); break; } } } }