亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? url_string.cc

?? liburl是一個小的C++庫
?? CC
字號:
/*  $Id: url_string.cc,v 1.4 2002/04/04 17:30:29 t16 Exp $  URL string implementation.  Copyright (C) 2002  Kasper Peeters <k.peeters@damtp.cam.ac.uk>  This program and its components are free software; you can  redistribute it and/or modify it under the terms of the GNU General  Public License as published by the Free Software Foundation; either  version 2, or (at your option) any later version.   This program and its components are distributed in the hope that it  will be useful, but WITHOUT ANY WARRANTY; without even the implied  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See  the GNU General Public License for more details.   You should have received a copy of the GNU General Public License in  the file COPYING accompanying this program; if not, write to the  Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#include <string>#include <iostream>#include <sstream>#include <utility>#include <algorithm>#include <stdexcept>#include <url/url_string.hh>url_string::url_string(const url_string &u) 	{	referrer = u.referrer;	original_url = u.original_url;	decoding_finished_ = u.decoding_finished_;	if(decoding_finished_) {		scheme = u.scheme;		url = u.url;		net_path = u.net_path;		abs_path = u.abs_path;		rel_path = u.rel_path;		params = u.params;		port = u.port;		if(port==0) port=default_port(); //is this correct?		query = u.query;		fragment = u.fragment;		username = u.username;		passwd = u.passwd;		}	}url_string::url_string(const std::string& u) 	: original_url(u), decoding_finished_(0) 	{	//port=default_port();	}url_string::url_string(const std::string& u, const std::string& ref) 	: original_url(u), decoding_finished_(0), referrer(ref)	{	//port=default_port(); why set ports on not decoded urls? decoding should set those	}url_string::url_string(const std::string& u, const url_string& ref) 	: original_url(u), decoding_finished_(0), referrer(ref.get_url())	{	//port=default_port(); why set ports on not decoded urls? decoding should set those	}url_string::url_string() 	{	port=default_port();	decoding_finished_=1; //no use to try anything on nothing	//is_relative ?	}url_string::~url_string() 	{	}url_string & url_string::operator=(const url_string &u) 	{	//port=default_port();	referrer = u.referrer;	original_url = u.original_url;	decoding_finished_ = u.decoding_finished_;	if(decoding_finished_) {		scheme = u.scheme;		url = u.url;		net_path = u.net_path;		abs_path = u.abs_path;		rel_path = u.rel_path;		params = u.params;		port = u.port;		if(port==0) port=default_port();		query = u.query;		fragment = u.fragment;		username = u.username;		passwd = u.passwd;		}	return *this;	}void url_string::finish_decoding_(void) const	{	if(decoding_finished_) return;	std::string::const_iterator loc;	loc = DecodeScheme(original_url.begin());	if(is_relative_) { // No scheme found in original_url.		DoRelDecode(loc);		} 	else {// It may still be relative. 		loc = HandleAbs(loc);		if(loc != original_url.end()) { // They left us some work to do.			DoRelDecode(loc);			}		}	fixup_();	decoding_finished_ = 1;	}int url_string::default_port(void) const	{	return 0;	}void url_string::DoRelDecode(std::string::const_iterator loc) const	{	std::string::const_iterator loc2;	loc=DecodeNetPath(loc);	if((loc2 = DecodeAbsPath(loc)) == loc) {		loc2 = DecodeRelPath(loc);		}	loc = DecodeParams(loc2);	loc = DecodeQuery(loc);	DecodeFragment(loc);		}std::string::const_iterator url_string::DecodeScheme(std::string::const_iterator loc) const	{	//starts at loc searches for a "scheme" and returns	//the position for the next decoding	std::string::const_iterator orig = loc, end=original_url.end();	//skip spaces	scheme="";	while(loc < end) {		if(isalnum(*loc)||*loc=='.') {			loc++;			} else break;		}	//step through the letters which are supposed to be the scheme    	while(loc < end) {		if(isalpha(*loc))			loc++;		else			break;		}		if(loc==end || *loc != ':') {		is_relative_ = true;		if(referrer.size()!=0)			scheme = url_string(referrer).get_scheme();		if(scheme.size()==0)			throw std::logic_error("no scheme, and no scheme in referrer either");		return orig;		}	is_relative_ = false;	scheme = original_url.substr(std::distance(original_url.begin(), orig),										  std::distance(orig, loc));	std::transform(scheme.begin(),scheme.end(),scheme.begin(),tolower);	loc++; // eat ':'	return loc;	}std::string::const_iterator url_string::DecodeNetPath(std::string::const_iterator loc)  const	{	if(referrer.size()!=0) {		//initilize those, if we bail out we use those of the referrer		url_string tmp(referrer);		username=tmp.get_username();		passwd=tmp.get_passwd();		port=tmp.get_port();		if(port==0) port=default_port();		net_path=tmp.get_net_path();		} 	else		{		port=default_port();		}	std::string::const_iterator orig = loc;	if(loc == original_url.end()) return loc;	/* Eat spaces */	while(loc != original_url.end() && isspace(*loc)) {	    loc++;	    }	if(loc == original_url.end()) return orig;		if(*loc == '/') loc++; /* this could be more terse */	else return orig;	if(loc == original_url.end()) return orig;		if(*loc == '/') loc++;	else return orig;		if(loc == original_url.end()) return orig;	//ok there should be some host indicator	//reset username etc	username.erase();	port=default_port();	passwd.erase();		orig = loc;	/* The next line is not exactly correct -- but unless someone	   wants to figure out international stuff,  this will work */	while(loc != original_url.end() && *loc!='/' && *loc!='#') {		loc++;		}		net_path = original_url.substr(std::distance(original_url.begin(), orig), 											 std::distance(orig,loc));	std::string::iterator i;	std::string::reverse_iterator ri=std::find(net_path.rbegin(),net_path.rend(),'@');	if(ri!=net_path.rend()) {		username=net_path.substr(0,std::distance(ri, net_path.rend()));		net_path=net_path.substr(std::distance(ri, net_path.rend()), 										 std::distance(net_path.rbegin(), ri));		//check username for passwd		i=find(username.begin(),username.end(),':');		if(i!=username.end()) {			i++;			passwd=username.substr(std::distance(username.begin(),i), std::distance(i,username.end())-1);			username=username.substr(0,std::distance(username.begin(),i)-1);			}		}		i=std::find(net_path.begin(),net_path.end(),':');	if(i!=net_path.end()) {		std::string::iterator nameend=i;		i++;		port=0;		while(i!=net_path.end() && isdigit(*i)) {			port = port * 10;			port += *i - '0';			i++;			}		net_path=net_path.substr(0,std::distance(net_path.begin(),nameend));		} 	return loc;	}std::string::const_iterator url_string::DecodeAbsPath(std::string::const_iterator loc)  const	{	std::string::const_iterator orig=loc,end=original_url.end();	abs_path="";	if(loc == end) {		abs_path="/";		return loc;		}	if(*loc != '/') return loc;	orig = loc;	while(loc < end && *loc!=';' && *loc!='#' && *loc!='?') {		loc++;		}	abs_path = original_url.substr(std::distance(original_url.begin(), orig), 											 std::distance(orig,loc));	return loc;	}std::string::const_iterator url_string::DecodeRelPath(std::string::const_iterator loc) const	{	rel_path="";	std::string::const_iterator orig=loc, end=original_url.end();	if(loc == end) return loc;	while(loc < end && *loc!=';' && *loc!='#' && *loc!='?') loc++;	rel_path = original_url.substr(std::distance(original_url.begin(), orig),											 std::distance(orig,loc));	if (referrer.size()!=0) 		abs_path = url_string(referrer).get_absolute_path();	if (abs_path.empty()) {		abs_path=rel_path;		return loc;		}	if (rel_path.empty()) return loc;		int i=abs_path.size()-1;	while(i>0 && abs_path[i]!='/') i--;	if (abs_path[i]!='/') {		abs_path=rel_path;		return loc;		}	abs_path = abs_path.substr(0,i+1)+rel_path;		return loc;	}std::string::const_iterator url_string::DecodeParams(std::string::const_iterator loc)  const	{	params="";	std::string::const_iterator orig=loc, end=original_url.end();	if(loc == end) return loc;	while(loc < end && *loc!='?' && *loc !='#') loc++;	if (loc-orig>0) 		params = original_url.substr(std::distance(original_url.begin(), orig)+1,											  std::distance(orig, loc)-1);	return loc;	}std::string::const_iterator url_string::DecodeQuery(std::string::const_iterator loc)  const	{	query="";	std::string::const_iterator orig=loc, end=original_url.end();	if(loc == end) return loc;	while(loc < end && *loc !='#') loc++;	if (loc-orig>0) 		query = original_url.substr(std::distance(original_url.begin(), orig)+1,											 std::distance(orig,loc)-1);	return loc;	}std::string::const_iterator url_string::DecodeFragment(std::string::const_iterator loc)  const	{	fragment.erase();	std::string::const_iterator orig=loc, end=original_url.end();	if(loc == end) return loc;	while(loc<end) 		loc++;	if(std::distance(orig,loc)>0) 		fragment = original_url.substr(std::distance(original_url.begin(), orig)+1, 												 std::distance(orig,loc)-1);	return loc;	}/* Default, do nothing try it as if it were a relative path */std::string::const_iterator url_string::HandleAbs(std::string::const_iterator loc) const	{	return loc;	}/* We provide a basic sort of relative -> absolute path conversion.   This is correct for http and probably for most other schemes.   If this is not the correct one, use a derived class.   After this, abs_path and url should be correct. */void url_string::fixup_() const	{	std::stringstream ss1;	ss1 << scheme << "://";	if (!username.empty()) {		ss1 << username;		if(!passwd.empty())			ss1 << ":" << passwd;		ss1 << "@";			}	ss1 << net_path;	if(port!=default_port())		ss1 << ":" << port;	// handle ../ pseudo-directories, replace /foo/bar/../foobar with /foo/foobar	unsigned int uploc, prevslash;	while((uploc=abs_path.find("/../"))!=abs_path.npos) {		if(uploc==0) break;		prevslash=abs_path.rfind("/",uploc-1);		if(prevslash+1>uploc)			break; // no more path elements to remove		abs_path=abs_path.substr(0,prevslash+1)+abs_path.substr(uploc+4);		}   // replace /./ elements with /	while((uploc=abs_path.find("/./"))!=abs_path.npos) {		abs_path=abs_path.substr(0,uploc)+abs_path.substr(uploc+2);		}	ss1 << abs_path;	if(!params.empty())		ss1 << ";" << params;	if(!query.empty())		ss1 << "?" << query;	if(!fragment.empty())		ss1 << "#" << fragment;	url=ss1.str();	}std::string url_string::get_url(void) const 	{	finish_decoding_();	return url;	}std::string url_string::get_scheme() const 	{	/* Scheme is always decoded */	finish_decoding_();	return scheme;	}std::string url_string::get_net_path() const	{	finish_decoding_();	return net_path;	}std::string url_string::get_absolute_path() const	{	finish_decoding_();	return abs_path;	}std::string url_string::get_relative_path() const	{	finish_decoding_();	return rel_path;	}std::string url_string::get_object() const	{	unsigned int pos;	if((pos=abs_path.rfind("/"))<=abs_path.npos) {		return abs_path.substr(pos+1);		}	else return abs_path;	}std::string url_string::get_parameters() const	{	finish_decoding_();	return params;	}int url_string::get_port(void) const	{	finish_decoding_();	return port;	}std::string url_string::get_query() const	{	finish_decoding_();	return query;	}std::string url_string::get_fragment() const	{	finish_decoding_();	return fragment;	}std::string url_string::get_username() const	{	finish_decoding_();	return username;	}std::string url_string::get_passwd() const	{	finish_decoding_();	return passwd;	}std::string url_string::get_original() const 	{	return original_url;	}std::string url_string::get_referrer() const 	{	return referrer;	}void url_string::set_username(const std::string& name)	{	finish_decoding_();	username=name;	}void url_string::set_passwd(const std::string& pw)	{	finish_decoding_();	passwd=pw;	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线视视频有精品| 色狠狠桃花综合| 欧美精品视频www在线观看| 亚洲国产精品一区二区www在线| 色综合久久综合网欧美综合网| 综合色中文字幕| 欧洲中文字幕精品| 日本在线观看不卡视频| 精品国产自在久精品国产| 国产毛片精品国产一区二区三区| 久久精品一区二区三区不卡牛牛 | 亚洲精品一卡二卡| 97久久人人超碰| 亚洲国产裸拍裸体视频在线观看乱了| 欧美精品1区2区3区| 国内精品第一页| 最好看的中文字幕久久| 欧美日韩电影一区| 国产成人亚洲综合a∨婷婷图片| 国产精品视频看| 欧美日韩综合一区| 国内精品免费在线观看| 亚洲欧美日韩中文播放| 51精品秘密在线观看| 国产精品亚洲一区二区三区在线| 最新久久zyz资源站| 欧美一区二区二区| 成人精品视频.| 日日欢夜夜爽一区| 国产欧美一区二区精品秋霞影院 | 亚洲激情图片qvod| 日韩欧美123| 色综合久久久久网| 精品一区二区综合| 亚洲韩国精品一区| 欧美激情一区二区三区全黄| 欧美自拍偷拍一区| 国产精品 欧美精品| 亚洲bdsm女犯bdsm网站| 国产精品久久毛片a| 日韩一区二区麻豆国产| 色呦呦网站一区| 国产精一区二区三区| 天使萌一区二区三区免费观看| 久久精品一区八戒影视| 91精品国产综合久久久蜜臀粉嫩 | 波多野结衣中文字幕一区二区三区 | 久久综合色综合88| 欧美日韩综合在线| 91无套直看片红桃| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 99精品视频免费在线观看| 美女视频第一区二区三区免费观看网站| 中文av字幕一区| 精品国产一区二区亚洲人成毛片| 欧美性高清videossexo| eeuss鲁一区二区三区| 国产在线看一区| 奇米色777欧美一区二区| 亚洲精品免费播放| 国产精品少妇自拍| 日本一区二区三区久久久久久久久不| 欧美一区二区啪啪| 在线91免费看| 欧美绝品在线观看成人午夜影视| 色一情一伦一子一伦一区| 风间由美一区二区av101| 国产在线视频不卡二| 精一区二区三区| 久久精品国产久精国产爱| 日日摸夜夜添夜夜添国产精品 | 亚洲不卡在线观看| 樱花草国产18久久久久| 亚洲丝袜制服诱惑| 综合分类小说区另类春色亚洲小说欧美| 国产日本欧美一区二区| 国产欧美日本一区二区三区| 国产日韩欧美综合在线| 国产拍欧美日韩视频二区| 久久精品一级爱片| 欧美激情一区二区三区蜜桃视频 | 一本久久a久久精品亚洲| 不卡一区二区在线| 99精品久久99久久久久| 99久久精品免费看国产| 成人综合婷婷国产精品久久蜜臀| 成人免费视频一区二区| 不卡一区在线观看| 91黄色免费观看| 欧美日韩国产中文| 欧美一二三四在线| www亚洲一区| 欧美国产精品一区二区三区| 国产精品人妖ts系列视频| 亚洲欧洲国产日韩| 亚洲一线二线三线视频| 日韩精品国产精品| 国产在线麻豆精品观看| 粉嫩一区二区三区在线看| 99精品欧美一区二区三区综合在线| 91片在线免费观看| 欧美一区日韩一区| 国产日韩精品一区二区三区| 亚洲天堂2014| 日本在线不卡一区| 国产成人午夜片在线观看高清观看| 成人免费视频网站在线观看| 日本道色综合久久| 日韩欧美在线一区二区三区| 久久精品人人爽人人爽| 一区二区三区视频在线观看| 偷拍一区二区三区四区| 国产老肥熟一区二区三区| 色综合久久天天| 日韩精品一区二区三区视频播放| 国产欧美日韩中文久久| 亚洲午夜激情网站| 国产一二精品视频| 色爱区综合激月婷婷| 日韩欧美国产午夜精品| 18欧美亚洲精品| 麻豆国产精品一区二区三区 | 亚洲日本免费电影| 美腿丝袜一区二区三区| 97se亚洲国产综合在线| 欧美mv和日韩mv国产网站| 樱桃国产成人精品视频| 国产精品影视在线| 这里只有精品99re| 亚洲视频图片小说| 国产中文字幕精品| 欧美高清视频在线高清观看mv色露露十八| 久久久久久麻豆| 天堂av在线一区| 色综合久久天天| 国产女人aaa级久久久级| 日韩综合在线视频| 一本到一区二区三区| 国产亚洲精品超碰| 久久久国产精华| 91麻豆福利精品推荐| 欧美成人在线直播| 亚洲精品免费视频| 高清成人免费视频| 精品国产欧美一区二区| 亚洲妇女屁股眼交7| 成人国产精品免费网站| 久久只精品国产| 蜜臀久久久99精品久久久久久| 在线看不卡av| 国产精品久线在线观看| 国产激情精品久久久第一区二区 | 欧美自拍偷拍一区| 亚洲欧美国产毛片在线| 成人黄色大片在线观看| 精品国产91久久久久久久妲己| 日韩专区欧美专区| 欧美影院一区二区三区| 亚洲区小说区图片区qvod| 国产91精品精华液一区二区三区| 精品免费视频一区二区| 免费看欧美女人艹b| 在线不卡免费av| 亚洲一二三四在线| 在线观看区一区二| 亚洲精品国产高清久久伦理二区| aaa国产一区| 亚洲色图欧美在线| 色婷婷av一区二区三区软件| 亚洲欧洲日韩av| 一本大道av一区二区在线播放| 中文字幕日韩一区| 91美女视频网站| 一级女性全黄久久生活片免费| 在线日韩一区二区| 午夜精品久久久久影视| 欧美老肥妇做.爰bbww视频| 日韩精品一区第一页| 日韩欧美色综合| 国产在线一区二区| 国产精品无码永久免费888| 成人午夜电影小说| 亚洲摸摸操操av| 欧美精品三级日韩久久| 青青国产91久久久久久| 精品国产91亚洲一区二区三区婷婷| 国产曰批免费观看久久久| 国产欧美精品国产国产专区| 暴力调教一区二区三区| 亚洲最新在线观看| 91精品国产欧美一区二区成人 | 欧美优质美女网站| 午夜电影一区二区| 亚洲精品在线一区二区| 成人高清av在线| 亚洲丶国产丶欧美一区二区三区| 欧美日韩1234| 国产馆精品极品| 一区二区三区蜜桃| 日韩免费视频线观看|