• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parseUrl函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parseUrl函数的典型用法代码示例。如果您正苦于以下问题:C++ parseUrl函数的具体用法?C++ parseUrl怎么用?C++ parseUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parseUrl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, const char* argv[]) {
    int rval = -1;

    struct Arguments args;
    if (!args.parseArguments(argc, argv)) { return rval; }

    if (args.api_mode == ApiMode::PROCESS) {
        rval = android_setprocnetwork(args.nethandle);
        if (rval != 0) {
            int errnum = errno;
            std::cerr << "android_setprocnetwork(" << args.nethandle << ") failed;"
                      << " errno: " << errnum << " [" << strerror(errnum) << "]"
                      << std::endl;
            return rval;
        }
    }

    struct Parameters parameters;
    if (!parseUrl(args, &parameters)) { return -1; }

    // TODO: Fall back from IPv6 to IPv4 if ss.ss_family is AF_UNSPEC.
    // This will involve changes to parseUrl() as well.
    struct FdAutoCloser closer = makeTcpSocket(
            parameters.ss.ss_family,
            (args.api_mode == ApiMode::EXPLICIT) ? args.nethandle
                                                 : NETWORK_UNSPECIFIED);
    if (closer.fd < 0) { return closer.fd; }

    return doHttpQuery(closer.fd, parameters);
}
开发者ID:MIPS,项目名称:system-extras,代码行数:30,代码来源:httpurl.cpp


示例2:

/* ****************************************************************************
*
* Reference::check -
*/
std::string Reference::check
(
  RequestType         requestType,
  const std::string&  indent,
  const std::string&  predetectedError,
  int                 counter
)
{
  if (string == "")
  {
    if ((requestType == SubscribeContextAvailability) || (requestType == SubscribeContext))
    {
      return "Empty Reference";
    }
  }

  std::string  url = string;
  std::string  host;
  int          port;
  std::string  path;
  std::string  protocol;

  if (parseUrl(url, host, port, path, protocol) == false)
  {
    return "Invalid URL";
  }

  return "OK";
}
开发者ID:Findeton,项目名称:fiware-orion,代码行数:33,代码来源:Reference.cpp


示例3: FORMATTING_TAG

void Parser::parseTag(const char* tag, size_t len) {
	bool hasAttributes;
	//printf("tag: %i %.*s\n", tagState, (int)len, tag);
	FORMATTING_TAG("b", BOLD);
	FORMATTING_TAG("i", ITALIC);
	FORMATTING_TAG("small", SMALL);
	FORMATTING_TAG("s", SMALL);
	FORMATTING_TAG("u", UNDERLINED);
	SIMPLE_TAG("table", TABLE);
	SIMPLE_TAG("tr", TR);
	SIMPLE_TAG("td", TD);
	//SIMPLE_TAG("li", LIST_ITEM);
	SPECIAL_TAG("li", addListItem());
	SPECIAL_TAG("code", addCodeTag());
	SPECIAL_TAG("quote", addQuoteTag());
	SIMPLE_TAG("ul", LIST);
	SIMPLE_TAG("ol", LIST);

	if(!strncasecmp("url=", tag, 4) || !strncasecmp("url:", tag, 4) || !strncasecmp("url ", tag, 4)) {
		//printf("url tag: %i %.*s\n", tagState, (int)len, tag);
		const char* url = tag + 4;
		size_t urlLen = len - 4;
		parseUrl(url, urlLen);
		return;
	}
	//C_TAG("url", ANCHOR, "a", "/a");
	COMPARE_TAG("url", return;);	// get rid of empty [url] tags.
开发者ID:Masken3,项目名称:wowfoot,代码行数:27,代码来源:parser.cpp


示例4: mUrl

RPCSub::RPCSub (const std::string& strUrl, const std::string& strUsername, const std::string& strPassword)
    : mUrl (strUrl), mSSL (false), mUsername (strUsername), mPassword (strPassword), mSending (false)
{
    std::string strScheme;

    if (!parseUrl (strUrl, strScheme, mIp, mPort, mPath))
    {
        throw std::runtime_error ("Failed to parse url.");
    }
    else if (strScheme == "https")
    {
        mSSL    = true;
    }
    else if (strScheme != "http")
    {
        throw std::runtime_error ("Only http and https is supported.");
    }

    mSeq    = 1;

    if (mPort < 0)
        mPort   = mSSL ? 443 : 80;

    WriteLog (lsINFO, RPCSub) << boost::str (boost::format ("callRPC sub: ip='%s' port=%d ssl=%d path='%s'")
                              % mIp
                              % mPort
                              % mSSL
                              % mPath);
}
开发者ID:justmoon,项目名称:rippled,代码行数:29,代码来源:RPCSub.cpp


示例5: dl_vlive_live

void dl_vlive_live(std::string url)
{
	streamInfo currentInfo;
	vidUrlInfo currentLiveInfo;
	m3u8Info currentMediaInfo;
	std::string v_title;
	std::string strUrl;
	int cnt = 0;
	float time = 0;

	getStreamInfo(retrievePage((char *)url.c_str()), &currentInfo, NULL, TYPE_VLIVE);
	getStreamInfo(retrievePage((char *)url.c_str()), NULL, &currentLiveInfo, TYPE_VLIVE_LIVE);
	for (int i = 0; i <= currentLiveInfo.num_list; i++)
		modifyUrl(&currentLiveInfo.url[i], TYPE_VLIVE_LIVE);
	printLine(3);
	getline(cin, v_title);
	printLine(5);
	while (strcmp(currentInfo.v_stat.c_str(), "LIVE_END") != 0)
	{
		parseStream(retrievePage((char*)currentLiveInfo.url[currentLiveInfo.num_list].c_str()), &currentMediaInfo);
		for (int i = 0; i <= currentMediaInfo.list_num; i++)
		{
			strUrl = "http://vlive.hls.edgesuite.net/" + parseUrl(currentLiveInfo.url[currentLiveInfo.num_list]) + currentMediaInfo.fname[i];
			retrieveFileFromUrl(strUrl, v_title, TYPE_VLIVE_LIVE, cnt, &time);
			std::this_thread::sleep_for(std::chrono::milliseconds((int)(currentMediaInfo.sec_sleep[i] - time) - 250));
			cnt++;
		}
		getStreamInfo(retrievePage((char *)url.c_str()), &currentInfo, NULL, TYPE_VLIVE);
	}
	cout << v_title;
	printLine(6);
}
开发者ID:qscx9512,项目名称:vlive-vdl-old,代码行数:32,代码来源:download.cpp


示例6: parseAuthzLine

/*
 * Parse an external acl helper line.
 *
 * Squid can be configured to pass various formats, we assume something
 * similar to the normal redirector format:
 *
 *   %URI %SRC %LOGIN
 *
 * For example:
 *   external_acl_type foo ttl=60 children=1 %URI %SRC %LOGIN /path/to/sg
 */
int parseAuthzLine(char *line, struct SquidInfo *s)
{
	char *field = NULL;

	sgLogDebug("got authz line %s", line);

	resetSquidInfo(s);

	/* get the URL and parse */
	if ((field = strtok(line, "\t ")) == NULL)
		return 0;

	HTUnEscape(field);
	if (!parseUrl(field, s))
		return 0;

	/* get the source address and parse */
	if ((field = strtok(NULL, " \t\n")) == NULL)
		return 0;

	HTUnEscape(field);      /* just in case, IPs should not need escaping */
	strcpy(s->src, field);

	/* get the login and parse */
	if ((field = strtok(NULL, " \t\n")) == NULL)
		return 0;

	if (!parseIdent(field,s))
		return 0;

	sgLogDebug("parsed authz line: furl='%s' domain='%s' surl='%s' src=%s ident='%s'",
		   s->furl, s->domain, s->surl, s->src, s->ident);

	return 1;
}
开发者ID:amcorreia,项目名称:squidGuard,代码行数:46,代码来源:sgRequest.c


示例7: matchEjs

/*
 *  When we come here, we've already matched either a location block or an extension
 */
static bool matchEjs(MaConn *conn, MaStage *handler, cchar *url)
{
    MaRequest   *req;
    MaLocation  *loc;
    EjsWeb      *web;
    cchar       *ext;
    char        urlbuf[MPR_MAX_FNAME];

    loc = conn->request->location;

#if UNUSED
    if (!(loc->flags & (MA_LOC_APP | MA_LOC_APP_DIR))) {
        return 1;
    }
#endif

    /*
     *  Send non-ejs content under web to another handler, typically the file handler.
     */
    req = conn->request;
    ext = conn->response->extension;

    if (ext && strcmp(ext, "mod") == 0) {
        maFormatBody(conn, "Bad Request", "Can't serve *.mod files");
        maFailRequest(conn, MPR_HTTP_CODE_BAD_REQUEST, "Can't server *.mod files");
        return 1;
    }

    if (parseUrl(conn) < 0) {
        return 1;
    }
    web = (EjsWeb*) conn->response->handlerData;

    /*
     *  TODO - need a more general way of handling these routes. Push back into the Ejscript framework
     */
    url = web->url;
    if (*url == '\0' || strcmp(url, "/") == 0) {
        mprSprintf(urlbuf, sizeof(urlbuf), "%s/web/index.ejs", web->appUrl);
        maSetRequestUri(conn, urlbuf);
        return 0;

    } else if (strcmp(url, "/favicon.ico") == 0) {
        mprSprintf(urlbuf, sizeof(urlbuf), "%s/web/favicon.ico", web->appUrl);
        maSetRequestUri(conn, urlbuf);
        return 0;

    } else if (strncmp(url, "/web/", 5) == 0 || *url == '\0') {
        if (!(ext && strcmp(ext, "ejs") == 0)) {
            return 0;
        }
    } else {
        if (loc->flags & (MA_LOC_APP | MA_LOC_APP_DIR) && ext && strcmp(ext, "ejs") == 0) {
            maFormatBody(conn, "Bad Request", "Can't serve *.ejs files outside web directory");
            maFailRequest(conn, MPR_HTTP_CODE_BAD_REQUEST, "Can't server *.ejs files outside web directory");
        }
    }
    return 1;
}
开发者ID:jsjohnst,项目名称:appweb,代码行数:62,代码来源:ejsAppweb.c


示例8: parseUrl

bool parseUrl(const std::string& spec, std::string& protocol, std::string& hostname, int& port)
{
	std::string path;
	std::string query;

	bool rv = parseUrl(spec, protocol, hostname, port, path, query);
	return rv && query.empty() && (path.empty() || path == "/");
}
开发者ID:hiwang123,项目名称:x0,代码行数:8,代码来源:Url.cpp


示例9: m_session

WinINetRequest::WinINetRequest(const String& url) :
    m_session(NULL),
    m_connect(NULL),
    m_request(NULL),
    m_used(false),
    m_url(parseUrl(url))
{
}
开发者ID:truedeity,项目名称:synergy-core,代码行数:8,代码来源:ArchInternetWindows.cpp


示例10: testParseUrl

    void testParseUrl ()
    {
        testcase ("parseUrl");

        std::string strScheme;
        std::string strDomain;
        int         iPort;
        std::string strPath;

        unexpected (!parseUrl ("lower://domain", strScheme, strDomain, iPort, strPath),
            "parseUrl: lower://domain failed");

        unexpected (strScheme != "lower",
            "parseUrl: lower://domain : scheme failed");

        unexpected (strDomain != "domain",
            "parseUrl: lower://domain : domain failed");

        unexpected (iPort != -1,
            "parseUrl: lower://domain : port failed");

        unexpected (strPath != "",
            "parseUrl: lower://domain : path failed");

        unexpected (!parseUrl ("UPPER://domain:234/", strScheme, strDomain, iPort, strPath),
            "parseUrl: UPPER://domain:234/ failed");

        unexpected (strScheme != "upper",
            "parseUrl: UPPER://domain:234/ : scheme failed");

        unexpected (iPort != 234,
            boost::str (boost::format ("parseUrl: UPPER://domain:234/ : port failed: %d") % iPort));

        unexpected (strPath != "/",
            "parseUrl: UPPER://domain:234/ : path failed");

        unexpected (!parseUrl ("Mixed://domain/path", strScheme, strDomain, iPort, strPath),
            "parseUrl: Mixed://domain/path failed");

        unexpected (strScheme != "mixed",
            "parseUrl: Mixed://domain/path tolower failed");

        unexpected (strPath != "/path",
            "parseUrl: Mixed://domain/path path failed");
    }
开发者ID:bachase,项目名称:rippled,代码行数:45,代码来源:StringUtilities.test.cpp


示例11: add_port_mapping

bool UPNPNAT::add_port_mapping(const char * _description, const char * _destination_ip, unsigned short int _port_ex, unsigned short int _port_in, char * _protocal)
{
	int ret;

	std::string host,path;
	unsigned short int port;
	ret=parseUrl(control_url.c_str(),host,&port,path);
	if(!ret)
	{
		status=NAT_ERROR;
		last_error="Fail to parseURl: "+describe_url+"\n";
		return false;
	}
	
	//connect 
	ret=tcp_connect(host.c_str(),port);
	if(!ret)
		return false;
	
	char buff[MAX_BUFF_SIZE+1];
	sprintf(buff,ADD_PORT_MAPPING_PARAMS,_port_ex,_protocal,_port_in,_destination_ip,_description);
	std::string action_params=buff;
	
	sprintf(buff,SOAP_ACTION,ACTION_ADD,service_type.c_str(),action_params.c_str(),ACTION_ADD);
	std::string soap_message=buff;
    
	sprintf(buff,HTTP_HEADER_ACTION,path.c_str(),host.c_str(),port,service_type.c_str(),ACTION_ADD,soap_message.size());
	std::string action_message=buff;
	
	std::string http_request=action_message+soap_message;
	
	//send request
	ret=send(tcp_socket_fd,http_request.c_str(),(int) http_request.size(),0);

	//wait for response 			
	std::string response;
	memset(buff, 0, sizeof(buff));
	while (ret=recv(tcp_socket_fd,buff,MAX_BUFF_SIZE,0) >0)
	{
		response+=buff;
		memset(buff, 0, sizeof(buff));
	}

	if(response.find(HTTP_OK)==std::string::npos)
	{
		status=NAT_ERROR;
		char temp[100];
		sprintf(temp,"Fail to add port mapping (%s/%s)\n",_description,_protocal);
		last_error=temp;
		printf(response.c_str());
		return false;
	}

	closesocket(tcp_socket_fd);
	status=NAT_ADD;
	return true;	
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:57,代码来源:upnpnat.cpp


示例12: if

void IconServerSession::parseData(const std::vector<char>& data) {
	static const char* const beginUrl = "GET ";
	static const char* const endHeader = "\r\n\r\n";
	const char* begin = &data[0];
	const char* end = &data[0] + data.size();

	for(const char* p = begin; p < end; p++) {
		if(status == WaitStatusLine) {
			if(*p == beginUrl[nextByteToMatch]) {
				nextByteToMatch++;
				if(nextByteToMatch >= 4) {
					status = RetrievingStatusLine;
					nextByteToMatch = 0;
				}
			} else {
				nextByteToMatch = 0;
			}
		} else if(status == RetrievingStatusLine) {
			if(*p == '\r' || *p == '\n') {
				status = WaitEndOfHeaders;
			} else if(*p >= 32 && *p <= 126 && urlLength < 255) {
				url.put(*p);
				urlLength++;
			} else {
				status = WaitStatusLine;
				nextByteToMatch = 0;
				url.str(std::string());
				url.clear();
				urlLength = 0;
			}
		}

		if(status == RetrievingStatusLine || status == WaitEndOfHeaders) {
			if(*p == endHeader[nextByteToMatch]) {
				nextByteToMatch++;
				if(nextByteToMatch >= 4) {
					status = WaitStatusLine;
					nextByteToMatch = 0;

					std::string urlString = url.str();
					if(!urlString.compare(urlString.size() - 9, std::string::npos, " HTTP/1.1")) {
						urlString.resize(urlString.size() - 9);
						parseUrl(urlString);
					}

					url.str(std::string());
					url.clear();
					urlLength = 0;
				}
			} else {
				nextByteToMatch = 0;
			}
		}
	}
}
开发者ID:glandu2,项目名称:rzauth,代码行数:55,代码来源:IconServerSession.cpp


示例13: SenderThreadParams

/* ****************************************************************************
*
* Notifier::sendNotifyContextAvailabilityRequest -
*
* FIXME: this method is very similar to sendNotifyContextRequest and probably
* they could be refactored in the future to have a common part using a parent
* class for both types of notifications and using it as first argument
*/
void Notifier::sendNotifyContextAvailabilityRequest
(
  NotifyContextAvailabilityRequest*  ncar,
  const std::string&                 url,
  const std::string&                 tenant,
  const std::string&                 fiwareCorrelator,
  RenderFormat                       renderFormat
)
{
    /* Render NotifyContextAvailabilityRequest */
    std::string payload = ncar->render(NotifyContextAvailability, "");

    /* Parse URL */
    std::string  host;
    int          port;
    std::string  uriPath;
    std::string  protocol;

    if (!parseUrl(url, host, port, uriPath, protocol))
    {
      std::string details = std::string("sending NotifyContextAvailabilityRequest: malformed URL: '") + url + "'";
      alarmMgr.badInput(clientIp, details);

      return;
    }

    /* Set Content-Type */
    std::string content_type = "application/json";

    /* Send the message (without awaiting response, in a separate thread to avoid blocking) */
    pthread_t            tid;
    SenderThreadParams*  params = new SenderThreadParams();

    params->ip               = host;
    params->port             = port;
    params->verb             = "POST";
    params->tenant           = tenant;
    params->resource         = uriPath;   
    params->content_type     = content_type;
    params->content          = payload;
    params->mimeType         = JSON;
    params->fiwareCorrelator = fiwareCorrelator;
    params->renderFormat     = renderFormatToString(renderFormat);

    strncpy(params->transactionId, transactionId, sizeof(params->transactionId));

    int ret = pthread_create(&tid, NULL, startSenderThread, params);
    if (ret != 0)
    {
      LM_E(("Runtime Error (error creating thread: %d)", ret));
      return;
    }
    pthread_detach(tid);
}
开发者ID:LeonanCarvalho,项目名称:fiware-orion,代码行数:62,代码来源:Notifier.cpp


示例14: createBackend

HttpBackend* HttpDirector::createBackend(const std::string& name, const std::string& url)
{
	std::string protocol, hostname, path, query;
	int port = 0;

	if (!parseUrl(url, protocol, hostname, port, path, query)) {
		TRACE("invalid URL: %s", url.c_str());
		return false;
	}

	return createBackend(name, protocol, hostname, port, path, query);
}
开发者ID:neeravkumar,项目名称:x0,代码行数:12,代码来源:HttpDirector.cpp


示例15: TEST

/* ****************************************************************************
*
* parseMalformedUrl2 -
*/
TEST(string, parseMalformedUrl2)
{
    std::string url = "http://20:host:8080/my/path";

    std::string host;
    int port;
    std::string path;

    bool result = parseUrl(url, host, port, path);

    EXPECT_FALSE(result) << "wrong result (shall be false)";
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:16,代码来源:commonString_test.cpp


示例16: ss_peek

///////////////////////////////////////////////////////////////////////////
//
//  Parsing Interface
//
Token *tokenizer_next( Tokenizer *tokenizer ) {
    wchar_t c, next;
    Token *token = NULL;

    next = ss_peek( tokenizer->ss_ );
    while ( next != WEOF && !token ) {
//  Whitespace
        if ( isWhitespaceStart( tokenizer->ss_, 0 ) ) {
            token = parseWhitespace( tokenizer );
        }
//  Strings
        else if ( isStringStart( tokenizer->ss_, 0 ) ) {
            token = parseString( tokenizer );
        }
//  Comments
        else if ( isCommentStart( tokenizer->ss_, 0 ) ) {
            token = parseComment( tokenizer );
        }
//  URL
        else if ( isUrlStart( tokenizer->ss_, 0 ) ) {
            token = parseUrl( tokenizer );
        }
//  SGML Comments
        else if ( isSGMLCommentStart( tokenizer->ss_, 0 ) ) {
            token = parseSGMLComment( tokenizer );
        }
//  Identifier
        else if ( isIdentifierStart( tokenizer->ss_, 0 ) ) {
            token = parseIdentifier( tokenizer );
        }
//  @keyword
        else if ( isAtkeywordStart( tokenizer->ss_, 0 ) ) {
            token = parseAtkeyword( tokenizer );
        }
//  #keyword
        else if ( isHashkeywordStart( tokenizer->ss_, 0 ) ) {
            token = parseHashkeyword( tokenizer );
        }
//  Number
        else if ( isNumberStart( tokenizer->ss_, 0 ) ) {
            token = parseNumber( tokenizer );
        }
//  Operators & Delims (everything else)
        else {
            token = parseEverythingElse( tokenizer );
        }
    }
    if ( token ) {
        return token;
    } else {
        return NULL;
    }
}
开发者ID:mikewest,项目名称:css-parser,代码行数:57,代码来源:tokenizer.c


示例17: strdup

// Load the dynamic library.
// Create the test player.
// Call setDataSource on the test player with the url in param.
status_t TestPlayerStub::setDataSource(
        const char *url, const KeyedVector<String8, String8> *headers) {
    if (!isTestUrl(url) || NULL != mHandle) {
        return INVALID_OPERATION;
    }

    mUrl = strdup(url);

    status_t status = parseUrl();

    if (OK != status) {
        resetInternal();
        return status;
    }

    ::dlerror();  // Clears any pending error.

    // Load the test player from the url. dlopen will fail if the lib
    // is not there. dls are under /system/lib
    // None of the entry points should be NULL.
    mHandle = ::dlopen(mFilename, RTLD_NOW | RTLD_GLOBAL);
    if (!mHandle) {
        ALOGE("dlopen failed: %s", ::dlerror());
        resetInternal();
        return UNKNOWN_ERROR;
    }

    // Load the 2 entry points to create and delete instances.
    const char *err;
    mNewPlayer = reinterpret_cast<NEW_PLAYER>(dlsym(mHandle,
                                                    "newPlayer"));
    err = ::dlerror();
    if (err || mNewPlayer == NULL) {
        // if err is NULL the string <null> is inserted in the logs =>
        // mNewPlayer was NULL.
        ALOGE("dlsym for newPlayer failed %s", err);
        resetInternal();
        return UNKNOWN_ERROR;
    }

    mDeletePlayer = reinterpret_cast<DELETE_PLAYER>(dlsym(mHandle,
                                                          "deletePlayer"));
    err = ::dlerror();
    if (err || mDeletePlayer == NULL) {
        ALOGE("dlsym for deletePlayer failed %s", err);
        resetInternal();
        return UNKNOWN_ERROR;
    }

    mPlayer = (*mNewPlayer)();
    return mPlayer->setDataSource(mContentUrl, headers);
}
开发者ID:0-t,项目名称:android_frameworks_av,代码行数:55,代码来源:TestPlayerStub.cpp


示例18: parseFile

void HippoGridManager::loadFromFile()
{
	// load user grid info
	parseFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grid_info.xml"), false);
	// merge default grid info, if newer. Force load, if list of grids is empty.
	parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty());
	// merge grid info from web site, if newer. Force load, if list of grids is empty.
	if (gSavedSettings.getBOOL("CheckForGridUpdates"))
		parseUrl("http://opensim-viewer.sourceforge.net/db/grids.php", !mGridInfo.empty());

	setDefaultGrid(gSavedSettings.getString("DefaultGrid"));
	setCurrentGrid(gSavedSettings.getString("CmdLineGridChoice"));
}
开发者ID:CasperWarden,项目名称:CasperViewer,代码行数:13,代码来源:hippogridmanager.cpp


示例19: assert

KUrl ConfigEntry::urlValue() const
{
  assert( m_argType == Path || m_argType == Url || m_argType == LdapUrl );
  assert( !isList() );
  QString str = m_value.toString();
  if ( m_argType == Path )
  {
    KUrl url;
    url.setPath( str );
    return url;
  }
  return parseUrl( m_argType, str );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:13,代码来源:configuration.cpp


示例20: parseLine

/*
 * Parse a redirector input line, format is:
 *
 *   URL ip-address/fqdn ident method
 *
 * for example
 *    http://www.example.com/page1.html 192.168.2.3/- andi GET
 */
int parseLine(char *line, struct SquidInfo *s)
{
	char *field = NULL;
	char *p = NULL;

	sgLogDebug("got redirector line %s", line);

	resetSquidInfo(s);

	/* get the URL and parse */
	if ((field = strtok(line, "\t ")) == NULL)
		return 0;

	HTUnEscape(field);
	if (!parseUrl(field, s))
		return 0;

	/* get the source address and parse */
	if ((field = strtok(NULL, " \t\n")) == NULL)
		return 0;

	if ((p = strchr(field, '/')) != NULL) {
		*p = 0;
		strcpy(s->src, field);
		strcpy(s->srcDomain, p + 1);
		if (s->srcDomain[0] == '-' && s->srcDomain[1] == 0)
			s->srcDomain[0] = 0;
	} else {
		strcpy(s->src, field);
	}

	/* get the identity */
	if ((field = strtok(NULL, " \t\n")) == NULL)
		return 0;

	if (!parseIdent(field,s))
		return 0;

	/* get the method */
	if ((field = strtok(NULL, " \t\n")) == NULL)
		return 0;

	strcpy(s->method, field);
	if (s->method[0] == '\0')
		return 0;

	sgLogDebug("parsed redirector line: furl='%s' domain='%s' surl='%s' src=%s ident='%s'",
		   s->furl, s->domain, s->surl, s->src, s->ident);

	return 1;
}
开发者ID:amcorreia,项目名称:squidGuard,代码行数:59,代码来源:sgRequest.c



注:本文中的parseUrl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parseValue函数代码示例发布时间:2022-05-30
下一篇:
C++ parseType函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap