免费教程_免费网赚教程_破解版软件-寂涯网络学习基地

当前位置: 主页 > 系统综合 > 各类编程 > 如何使用Google Url安全解析URL(3)

如何使用Google Url安全解析URL(3)

时间:2011-12-12 16:13来源:未知 整理:寂涯网络 点击:


 
 
 
 
template<typename STR>
bool InitCanonical(const STR& input_spec,
                   std::string* canonical,
                   url_parse::Parsed* parsed) {
  // Reserve enough room in the output for the input, plus some extra
so that
  // we have room if we have to escape a few things without reallocating.
  canonical->reserve(input_spec.size() + 32);
  url_canon::StdStringCanonOutput output(canonical);
  bool success = url_util::Canonicalize(
      input_spec.data(), static_cast<int>(input_spec.length()),
      NULL, &output, parsed);
  output.Complete();  // Must be done before using string.
  return success;
}  
 
 
 
 
 
 
 
 
 
 
 
 
 
template<typename STR>
bool InitCanonical(const STR& input_spec,
                   std::string* canonical,
                   url_parse::Parsed* parsed) {
  // Reserve enough room in the output for the input, plus some extra
so that
  // we have room if we have to escape a few things without reallocating.
  canonical->reserve(input_spec.size() + 32);
  url_canon::StdStringCanonOutput output(canonical);
  bool success = url_util::Canonicalize(
      input_spec.data(), static_cast<int>(input_spec.length()),
      NULL, &output, parsed);
  output.Complete();  // Must be done before using string.
  return success;
    在函数InitCanonical中,调用了url_util命名空间的Canonicalize( ->
DoCanonicalize)进行解析,主要的解析过程在url_parse中完成。
  了解了解析过程,我们用起来也就很快了,其实也没什么难度,就是几个方法,挺简单
的:
  以下的一些方法是判断解析的URL中是否包含这些元素:
   在函数InitCanonical中,调用了url_util命名空间的Canonicalize( ->
DoCanonicalize)进行解析,主要的解析过程在url_parse中完成。
  了解了解析过程,我们用起来也就很快了,其实也没什么难度,就是几个方法,挺简单
的:
  以下的一些方法是判断解析的URL中是否包含这些元素:
  

 

本页地址 http://www.jybase.net/biancheng/20111212709.html

百度搜索更多

谷歌搜索更多

顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------

评价:
昵称: 验证码:点击我更换图片
推荐内容
赞助商
赞助商


关于本站免责声明视频更新google百度地图视频地图RRS订阅

如有什么问题请在本站留言,或发邮件到 hxt167#foxmail.com