/////////////////////////////////////////////////////////////////////// /// Function: XosWebRtcClientConnection:: /// /// Author: $author$ /// Date: 4/1/2012 /////////////////////////////////////////////////////////////////////// bool XosWebRtcClientConnection::ParseServerResponse(const std::string& response, size_t content_length, size_t* peer_id, size_t* eoh) { LOG(INFO) << response; int status = GetResponseStatus(response.c_str()); if (status != 200) { LOG(LS_ERROR) << "Received error from server"; Close(); callback_->OnDisconnected(); return false; } *eoh = response.find("\r\n\r\n"); ASSERT(*eoh != std::string::npos); if (*eoh == std::string::npos) return false; *peer_id = -1; // See comment in peer_channel.cc for why we use the Pragma header and // not e.g. "X-Peer-Id". GetHeaderValue(response, *eoh, "\r\nPragma: ", peer_id); return true; }
/*****************************************************************************//** * @brief This function is called to start the whole process of contacting the * remote connect server and getting an action update * * @param none * @return next time to check for an update in seconds. * @author Neal Shurmantine * @version * 02/24/2015 Created. *******************************************************************************/ uint32_t RAS_CheckActionUpdate(void) { char pin[5]; int n; getRemoteConnectPin(pin); pin[4] = 0; for (n = 0; n < 4; ++n) { if ( (pin[n] < '0') || (pin[n] > '9') ) { return REMOTE_CONNECT_DEFAULT_CHECK_TIME; } } RAS_RemoteConnectCheckTime = REMOTE_CONNECT_DEFAULT_CHECK_TIME; REST_CLIENT_QUERY_STRUCT_PTR p_query = (REST_CLIENT_QUERY_STRUCT_PTR)OS_GetMemBlock(sizeof(REST_CLIENT_QUERY_STRUCT)); LoadDefaultClientData(p_query, &hunterDouglasRASServerSSLParameters,HTTPSRV_REQ_GET,action_update_get_return); p_query->socket_options.connection_timeout = 18 * SEC_IN_MS; /* p_query->socket_options.send_timeout = 5 * SEC_IN_MS; p_query->socket_options.rto = 2 * SEC_IN_MS; p_query->socket_options.maxrto = 5 * SEC_IN_MS; */ MakeAuthorizationString(p_query->authorize,false); snprintf(p_query->resource,MAX_RESOURCE_NAME_LENGTH, HUB_ACTION_GET_RESOURCE, RMT_GetAPIVersion()); ConnectToServer(p_query); if (p_query->connection.socket) { if (GetResource(p_query)) { p_query->callback(p_query); } if (GetResponseStatus()->code == 401) { printf("Dissociate this hub!\n"); clearRegistrationData(); } DisconnectFromServer(p_query); } RAS_Status = p_query->status; OS_ReleaseMemBlock((void*)p_query); return RAS_RemoteConnectCheckTime; }
NS_IMETHODIMP nsViewSourceChannel::GetResponseStatus(uint32_t *aResponseStatus) { return !mHttpChannel ? NS_ERROR_NULL_POINTER : mHttpChannel->GetResponseStatus(aResponseStatus); }