本文整理汇总了C++中CUrl::GetScheme方法的典型用法代码示例。如果您正苦于以下问题:C++ CUrl::GetScheme方法的具体用法?C++ CUrl::GetScheme怎么用?C++ CUrl::GetScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrl
的用法示例。
在下文中一共展示了CUrl::GetScheme方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostHTTP
int CHttpRequest::PostHTTP(CUrl& iUrl, const CString& RawData, const CString& iE, inetSocket& Sock){
CString Request;
if (ProxyURL.StrLength() && Proxy.isValid()) {
Request += "POST "; Request += iUrl.GetScheme(); Request+="://";
Request += iUrl.GetHost();
if (iUrl.GetPortValue() != 80) {
Request+=":";
Request += iUrl.GetPort();
}
Request += iUrl.GetUrlPath(); Request += " HTTP/1.0"; Request+=iE;
} else {
Request += "POST "; Request += iUrl.GetUrlPath(); Request += " HTTP/1.0"; Request+=iE;
Request += "Host: "; Request += iUrl.GetHost(); Request+=iE;
}
for (int i=0;i<RHeaderParams.entries_count();i++) {
Request+=RHeaderParams.get_name(i);
Request+=": ";
Request+=RHeaderParams.get_value(i);
Request += iE;
}
Request += iE;
Request += RawData;
if (!Send(Sock, Request)) return 0;
ProcessHeader(Sock);
ProcessData(Sock);
if (RData.StrLength()) {
RHeaderResponse.clear();
RStatusValue = 200;
RStatus = "200";
return 1;
} else return 0;
}
示例2:
CVector<CString> CUrlTree::UrlToVector(const CUrl& Url) const {
CVector<CString> Vector;
CString MidString;
MidString += Url.GetScheme();
MidString += ":/";
#ifdef _UNIX
if (Url.GetScheme().Same(g_strProto_FILE)) {
MidString += "/";
}
#endif
Vector += MidString;
MidString = Url.GetHost();
if (MidString.GetLength() && Url.GetPortValue() != 80) {
MidString += ":";
MidString += Url.GetPort();
}
if (MidString.GetLength()) {
Vector += MidString;
}
int HostVectorSize = Vector.GetSize();
CVector<CString> Vector2;
CString::StrToVector(Url.GetUrlPath(), '/', &Vector2);
Vector += Vector2;
if (((int) Vector.GetSize() > HostVectorSize) && (!Vector[HostVectorSize].GetLength()))
Vector.RemoveAt(HostVectorSize);
return Vector;
}
示例3: ProcessData
int CHttpRequest::GetHTTP09(CUrl& iUrl, const CString& iE, inetSocket& Sock){
/*
attempt a retrieval of HTTP/0.9
*/
CString Request;
if (RLimit) Request += "GET "; else Request+="HEAD ";
Request += iUrl.GetScheme(); Request+="://";
Request += iUrl.GetHost();
if (iUrl.GetPortValue() != 80) {
Request+=":";
Request += iUrl.GetPort();
}
Request += iUrl.GetUrlPath(); Request+=iE;
for (int i=0;i<RHeaderParams.entries_count();i++) {
Request+=RHeaderParams.get_name(i);
Request+=": ";
Request+=RHeaderParams.get_value(i);
Request += iE;
}
Request += iE;
#ifdef _U_DEBUG
cout << "# HTTP 0.9 Request: =====" << endl;
cout << Request;
cout << "=====================" << endl;
#endif
/*
issue request
*/
if (!Send(Sock, Request)) return 0;
RHeader.Free();
RData.Free();
RStatus.Free();
RStatusValue = -1;
ProcessData(Sock);
if (RData.StrLength()) {
RHeaderResponse.clear();
RStatusValue = 200;
RStatus = "200";
return 1;
} else if (RStatusValue != -1) {
return 0;
} else {
RStatusValue = HTTPR_USER + 3;
return 0;
}
}
示例4: NewURL
int CHttpRequest::GetHTTP10(CUrl& iUrl, const CString& iE, inetSocket& Sock){
/*
attempt a retrieval of HTTP/1.0
*/
CString Request;
if (ProxyURL.StrLength() && Proxy.isValid()) {
if (RLimit) Request += "GET "; else Request+="HEAD ";
Request += iUrl.GetScheme(); Request+="://";
Request += iUrl.GetHost();
if (iUrl.GetPortValue() != 80) {
Request+=":";
Request += iUrl.GetPort();
}
Request += iUrl.GetUrlPath(); Request += " HTTP/1.0"; Request+=iE;
} else {
if (RLimit) Request += "GET "; else Request+="HEAD ";
Request += iUrl.GetUrlPath(); Request += " HTTP/1.0"; Request+=iE;
Request += "Host: "; Request += iUrl.GetHost(); Request+=iE;
}
for (int i=0;i<RHeaderParams.entries_count();i++) {
Request+=RHeaderParams.get_name(i);
Request+=": ";
Request+=RHeaderParams.get_value(i);
Request += iE;
}
Request += iE;
#ifdef _U_DEBUG
cout << "# HTTP Request: =====" << endl;
cout << Request;
cout << "=====================" << endl;
#endif
/*
issue request
*/
CString RLoc;
if (!Send(Sock, Request)) return 0;
ProcessHeader(Sock);
ProcessData(Sock);
switch(RStatusValue) {
case 200: return 1;
case 301:
case 302:
case 303:
case 307:
if (!FollowRedirections) return RStatusValue;
RLoc = RHeaderResponse.get_value("Location");
if (RLoc.StrLength()) {
/*
HTTP 1.1 - Temporary Redirect is 302 and 307
RedirectVector is relevant for final URL address
that could be retrieved
*/
if (!RedirectVector.Contains(RLoc)) {
RedirectVector+=RLoc;
CUrl NewURL(RLoc);
if (!Proxy.isValid()) {
inetSocket Sock2(NewURL.GetPortValue(), NewURL.GetHost());
return GetHTTP10(NewURL, iE, Sock2);
} else {
Sock.Reopen();
return GetHTTP10(NewURL, iE, Sock);
}
}
}
return RStatusValue;
case 305: /* use proxy */
RLoc = RHeaderResponse.get_value("Location");
if (RLoc.StrLength()) {
CUrl ProxyURL(RLoc);
if (ProxyURL.isValid()) {
inetSocket ProxySock(ProxyURL.GetPortValue(), ProxyURL.GetHost());
if (wsLastError.StrLength()) return RStatusValue;
return GetHTTP10(iUrl, iE, ProxySock);
}
}
return RStatusValue;
default: return RStatusValue;
}
}
示例5: RunConverter
//.........这里部分代码省略.........
if (variables.count("length"))
contentLength = length;
if (variables.count("interrupt-name"))
name = StringToWString(interruptName);
else
{
name = NewGuid();
Tell(_T("Generated interrupt name is %s"), name.c_str());
}
if (variables.count("interrupt-directory"))
_conversionFileStoragePath = StringToWString(interruptDirectory);
if (variables.count("content-title"))
title = StringToWString(contentTitle);
else
title = _T("");
#pragma region input output file handling
wstring defaultExtension;
if (IsVista())
defaultExtension = _T(".dvr-ms");
else
defaultExtension = _T(".wtv");
ATL_URL_SCHEME urlScheme;
CUrl inputUrl;
if (!inputUrl.CrackUrl(StringToWString(input).c_str()))
urlScheme = ATL_URL_SCHEME_FILE;
else
urlScheme = inputUrl.GetScheme();
if (urlScheme == -1)
urlScheme = ATL_URL_SCHEME_FILE;
wstring inputPath = StringToWString(input);
CPath outputPath;
if (urlScheme == ATL_URL_SCHEME_FILE)
{
CPath input = inputPath.c_str();
if (input.IsFileSpec())
{
TCHAR szCurrentDirectory[MAX_PATH];
if (!GetCurrentDirectory(MAX_PATH, szCurrentDirectory))
throw CarverLab::Exception(GetLastError());
wstring currentDirectory = (LPCTSTR)szCurrentDirectory;
inputPath = currentDirectory + _T("\\") + inputPath.c_str();
input = inputPath.c_str();
}
if (!input.FileExists())
throw CarverLab::Exception(_T("MPEG2 input path does not exist."));
if (!variables.count("output"))
outputPath = inputPath.c_str();
else
outputPath = StringToWString(output).c_str();
}
else if (urlScheme == ATL_URL_SCHEME_HTTP ||
urlScheme == ATL_URL_SCHEME_HTTPS)
{
if (!variables.count("output"))