BUrl::BUrl(const BUrl& base, const BString& location) : fUrlString(), fProtocol(), fUser(), fPassword(), fHost(), fPort(0), fPath(), fRequest(), fAuthorityValid(false), fUserInfoValid(false), fHasUserName(false), fHasPassword(false), fHasHost(false), fHasPort(false), fHasFragment(false) { // This implements the algorithm in RFC3986, Section 5.2. BUrl relative(location); if (relative.HasProtocol()) { SetProtocol(relative.Protocol()); if (relative.HasAuthority()) SetAuthority(relative.Authority()); SetPath(relative.Path()); SetRequest(relative.Request()); } else { if (relative.HasAuthority()) { SetAuthority(relative.Authority()); SetPath(relative.Path()); SetRequest(relative.Request()); } else { if (relative.Path().IsEmpty()) { _SetPathUnsafe(base.Path()); if (relative.HasRequest()) SetRequest(relative.Request()); else SetRequest(base.Request()); } else { if (relative.Path()[0] == '/') SetPath(relative.Path()); else { BString path = base._MergePath(relative.Path()); SetPath(path); } SetRequest(relative.Request()); } if (base.HasAuthority()) SetAuthority(base.Authority()); } SetProtocol(base.Protocol()); } if (relative.HasFragment()) SetFragment(relative.Fragment()); }
BUrl::BUrl(const BUrl& base, const BString& location) : fUrlString(), fProtocol(), fUser(), fPassword(), fHost(), fPort(0), fPath(), fRequest(), fHasAuthority(false) { // This implements the algorithm in RFC3986, Section 5.2. BUrl relative(location); if (relative.HasProtocol()) { SetProtocol(relative.Protocol()); SetAuthority(relative.Authority()); SetPath(relative.Path()); // TODO _RemoveDotSegments() SetRequest(relative.Request()); } else { if (relative.HasAuthority()) { SetAuthority(relative.Authority()); SetPath(relative.Path()); // TODO _RemoveDotSegments() SetRequest(relative.Request()); } else { if (relative.Path().IsEmpty()) { SetPath(base.Path()); if (relative.HasRequest()) SetRequest(relative.Request()); else SetRequest(Request()); } else { if (relative.Path()[0] == '/') SetPath(relative.Path()); else { BString path = base.Path(); // Remove last part of path (the file, if any) so we get the // "current directory" path.Truncate(path.FindLast('/') + 1); path += relative.Path(); // TODO _RemoveDotSegments() SetPath(path); } SetRequest(relative.Request()); } SetAuthority(base.Authority()); } SetProtocol(base.Protocol()); } SetFragment(relative.Fragment()); }
HTTPRequestHeader& HTTPRequestHeader::operator=(const HTTPRequestHeader& header) { HTTPHeader::operator=(header); SetRequest(header.fMethod, header.fURL); fUserAgent = header.fUserAgent; return *this; }
void CParty::SetEndParty() { updateCalcMember(); { // 파티 해체 알림 CNetMsg::SP rmsg(new CNetMsg); PartyMsg(rmsg, MSG_PARTY_END); SendToAllPC(rmsg); } // 초대 거절 if (GetRequestIndex() > 0) { CPC* pRequestPC = PCManager::instance()->getPlayerByCharIndex(GetRequestIndex()); if (pRequestPC) { CNetMsg::SP rmsg(new CNetMsg); PartyMsg(rmsg, MSG_PARTY_REJECT_SRC); SEND_Q(rmsg, pRequestPC->m_desc); } SetRequest(-1, ""); } for(int i=0; i < MAX_PARTY_MEMBER; i++) { CPartyMember* pMember = (CPartyMember*)GetMemberByListIndex(i); if(pMember) { CPC* pc = pMember->GetMemberPCPtr(); if(pc && (pc->m_pZone->IsExpedRaidZone() || pc->m_pZone->IsPartyRaidZone()) && pc->m_nJoinInzone_ZoneNo >=0 && pc->m_nJoinInzone_RoomNo >= 0) { CNetMsg::SP rmsg(new CNetMsg); RaidInzoneQuitReq(rmsg,1,0); do_Raid(pc, rmsg); } } } CPartyMember* pMember=NULL; for(int i=0; i < MAX_PARTY_MEMBER; i++) { pMember = (CPartyMember*)GetMemberByListIndex(i); if(pMember) SetMemberPCPtr(pMember->GetCharIndex(), NULL); delete m_listMember[i]; m_listMember[i] = NULL; } }
BEGIN_NCBI_SCOPE BEGIN_objects_SCOPE // namespace ncbi::objects:: int CMSSearch::SetUpSearchSettings(CRef <CMSSearchSettings> & SearchSettings, bool IsIterative) { // the ordinal number of the SearchSettings int Settingid(0); // set up search settings if(IsIterative) { Settingid = 1 + (*SetRequest().begin())->SetMoresettings().Set().size(); (*SetRequest().begin())->SetMoresettings().Set().push_back(SearchSettings); } else { (*SetRequest().begin())->SetSettings(*SearchSettings); } SearchSettings->SetSettingid() = Settingid; return Settingid; }
/* * This function takes a URL in string-form and parses the components of the URL out. */ status_t BUrl::_ExplodeUrlString(const BString& url) { _ResetFields(); // RFC3986, Appendix C; the URL should not contain whitespace or delimiters // by this point. if (_ContainsDelimiter(url)) return B_BAD_VALUE; explode_url_parse_state state = EXPLODE_PROTOCOL; int32 offset = 0; int32 length = url.Length(); const char *url_c = url.String(); // The regexp is provided in RFC3986 (URI generic syntax), Appendix B // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))? // The ensuing logic attempts to simulate the behaviour of extracting the groups // from the string without requiring a group-capable regex engine. while (offset < length) { switch (state) { case EXPLODE_PROTOCOL: { int32 end_protocol = char_offset_until_fn_false(url_c, length, offset, explode_is_protocol_char); if (end_protocol < length) { SetProtocol(BString(&url_c[offset], end_protocol - offset)); state = EXPLODE_PROTOCOLTERMINATOR; offset = end_protocol; } else { // No protocol was found, try parsing from the string // start, beginning with authority or path SetProtocol(""); offset = 0; state = EXPLODE_AUTHORITYORPATH; } break; } case EXPLODE_PROTOCOLTERMINATOR: { if (url[offset] == ':') { offset++; } else { // No protocol was found, try parsing from the string // start, beginning with authority or path SetProtocol(""); offset = 0; } state = EXPLODE_AUTHORITYORPATH; break; } case EXPLODE_AUTHORITYORPATH: { // The authority must start with //. If it isn't there, skip // to parsing the path. if (strncmp(&url_c[offset], "//", 2) == 0) { state = EXPLODE_AUTHORITY; offset += 2; } else { state = EXPLODE_PATH; } break; } case EXPLODE_AUTHORITY: { int end_authority = char_offset_until_fn_false(url_c, length, offset, explode_is_authority_char); SetAuthority(BString(&url_c[offset], end_authority - offset)); state = EXPLODE_PATH; offset = end_authority; break; } case EXPLODE_PATH: { int end_path = char_offset_until_fn_false(url_c, length, offset, explode_is_path_char); SetPath(BString(&url_c[offset], end_path - offset)); state = EXPLODE_REQUEST; offset = end_path; break; } case EXPLODE_REQUEST: // query { if (url_c[offset] == '?') { offset++; int end_request = char_offset_until_fn_false(url_c, length, offset, explode_is_request_char); SetRequest(BString(&url_c[offset], end_request - offset)); offset = end_request; } state = EXPLODE_FRAGMENT; break; } case EXPLODE_FRAGMENT: { if (url_c[offset] == '#') { offset++; SetFragment(BString(&url_c[offset], length - offset)); offset = length; } state = EXPLODE_COMPLETE; break; } case EXPLODE_COMPLETE: // should never be reached - keeps the compiler happy break; } } return B_OK; }
HTTPRequestHeader::HTTPRequestHeader(const std::string& method, const std::string& url, int majorVer, int minorVer) { _Init(); SetRequest(method, url); }
// 원정대 종료 함수, 게임 서버 전용과 헬퍼 전용 함수가 다르다. void CExpedition::SetEndExped() { CExpedMember* pMember=NULL; CPC* pc=NULL; int i,j; // 레이드 안이면 인존 바깥에 시작 지점에 위치 하게 처리 for(i=0; i < MAX_EXPED_GROUP; i++) { for(j=0; j < MAX_EXPED_GMEMBER; j++) { pMember = (CExpedMember*) GetMemberByListIndex(i,j); if(pMember) { pc = TO_PC(pMember->GetMemberPCPtr()); if( pc && pc->m_index == -1 ) pc = NULL; if(pc && pc->m_nJoinInzone_ZoneNo >=0 && pc->m_nJoinInzone_RoomNo >= 0) { // 레이드존을 나가야 되는데 앉아있어서 못나가는 버그 수정 if(pc->IsSetPlayerState(PLAYER_STATE_SITDOWN)) { pc->TogglePlayerState(PLAYER_STATE_SITDOWN); pc->CalcStatus(true); } { CNetMsg::SP rmsg(new CNetMsg); RaidInzoneQuitReq(rmsg,1,0); do_Raid(pc, rmsg); } } } } } { // 원정대 해체 알림 CNetMsg::SP rmsg(new CNetMsg); ExpedMsg(rmsg, MSG_ENDEXPED_REP); SendToAllPC(rmsg); } // 초대 거절 if (GetRequestIndex() > 0) { CPC* pRequestPC = PCManager::instance()->getPlayerByCharIndex(GetRequestIndex()); if (pRequestPC) { CNetMsg::SP rmsg(new CNetMsg); ExpedMsg(rmsg, MSG_REJECT_SRC); SEND_Q(rmsg, pRequestPC->m_desc); } SetRequest(-1, ""); } // 모든 맴버의 메모리는 NULL로 바꾸어준다. for(i=0; i < MAX_EXPED_GROUP; i++) { for(j=0; j < MAX_EXPED_GMEMBER; j++) { CExpedMember* pMember = (CExpedMember*)GetMemberByListIndex(i,j); if(pMember) { SetMemberPCPtr(pMember->GetCharIndex(), NULL); DeleteMember(pMember->GetCharIndex()); } } } }