本文整理汇总了C++中URL::GetFullPath方法的典型用法代码示例。如果您正苦于以下问题:C++ URL::GetFullPath方法的具体用法?C++ URL::GetFullPath怎么用?C++ URL::GetFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::GetFullPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TaskValid
bool HttpRetriever::TaskValid( long bsize )
{
KSocket *csock = this->mCtrlSock ;
KSocket *dsock = this->mTranSock ;
URL * furl = this->mUrl ;
long * size = & bsize ;
bool dret ;
char rbuff[1024] = {0};
char *pos = rbuff ;
char *s = 0 ;
char range[50] = {0};
HttpHeader header;
//fprintf(stderr , " GET %s \n" ,furl->GetPath());
header.AddHeader( "GET", furl->GetFullPath() );
header.AddHeader( "Host", furl->GetHost());
header.AddHeader( "Connection", "Close");
//header.Dump() ;
sprintf(range,"bytes=%ld-", *size);
header.AddHeader( "Range",range);
std::string hs = header.HeaderString() ;
csock->Write(hs.c_str(), hs.length());
fprintf(stderr , "%s" , hs.c_str());
int rlen = 0 ;
do
{
rlen = csock->Peek(rbuff + rlen , sizeof(rbuff) );
fprintf(stderr, "Peeking %s \n" , rbuff );
if( rlen <= 0 ) break ;
if( ( s = strstr(rbuff ,"\r\n\r\n") ) != 0 )
{
*size = s - rbuff + 4 ;
break ;
}
}while(true);
header.ClearHeaders();
header.Parse(rbuff);
//header.Dump() ;
std::string status = header.GetHeader( "Status" ) ;
if ( status.compare("400") < 0 && status.compare("300") >= 0 )
{
//if follow into the redirector url
//rewrite url
//now this function lack test, i think i cant work correct
fprintf(stderr , "400 Redirect Signal found\n");
return false ;
}
else if ( status.compare("300") < 0 && status.compare("200") >= 0 )
{
//normal response
}
else //if( status.compare("200") < 0 || status.compare("400") >= 0 )
{
fprintf(stderr,"Header status (%s) \n",header.GetHeader( "Status" ).c_str() );
*size = 0 ;
return false ;
}
//read head now , really data
memset(rbuff,0,sizeof(rbuff));
csock->Read(rbuff , *size ) ;
//fprintf(stderr,"Header (%ld) is %s \n", *size ,rbuff);
*size = atol(header.GetHeader( "Content-Length" ).c_str());
this->mContentLength = * size ;
dsock->SetSocket(csock) ;
dret = true ;
return dret ;
return false ;
}