[CDN 技术] Curl在Squid测试中可能出现的问题

Nov 15th, 2008

转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]

本文链接: http://www.php-oa.com/2008/11/15/curl-squid-head.html

 

在squid测试中,使用的最多的除了浏览器本身的抓http头的软件外,我想使用的最多的就是Curl了吧.

#curl -I http://www.php-oa.com

这是最容易得到http头的方法,但根据我很久的测试,发现curl得到http头和浏览器本身是不一样的.所以使用Wireshark抓了一下Curl的包来分析.发现猜的不错.

在浏览器中我们打开一个网页元素时,头是这样的

GET /index.php HTTP/1.1

但Curl其实和浏览器不一样,它使用的方法是HEAD.根据RFC2616

  HEAD

除了服务器不能在响应中返回消息体,HEAD 方法与 GET 相同.HEAD 请求的响应中的 HTTP 头部中包含的元信息应该与 GET 请求发送的响应中的信息相同.该方法可用来获取请求暗示实体的元信息,  而不需要传输实体本身.   该方法常用来测试超文本链接的有效性、可用性和最近的修改.

所以,Curl和浏览器本身的是不一样的,他不包括实体内容,所以大家使用Curl测试http头时要注意.
 

 

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
Tags:
  1. 骡骡
    Nov 27th, 2008 at 13:37
    Reply | Quote | #1

    请教:
    我编译的squid在运行出现问题
    # cat cache.log
    2008/11/27 13:17:03| storeDirWriteCleanLogs: Starting…
    2008/11/27 13:17:03| Finished. Wrote 14898 entries.
    2008/11/27 13:17:03| Took 0.01 seconds (2102158.88 entries/sec).
    2008/11/27 13:17:03| logfileRotate: /home/squid/var/logs/store.log
    2008/11/27 13:17:03| logfileRotate: /home/squid/var/logs/access.log
    2008/11/27 13:17:38| squidaio_queue_request: WARNING – Queue congestion
    2008/11/27 13:17:52| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:18:53| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:19:54| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:20:41| squidaio_queue_request: WARNING – Queue congestion
    2008/11/27 13:20:55| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:21:56| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:22:57| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:23:58| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:24:59| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:25:05| squidaio_queue_request: WARNING – Queue congestion
    2008/11/27 13:26:00| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:27:01| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:28:02| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:29:03| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:30:04| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:31:05| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:32:06| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:33:07| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:34:08| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:35:09| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:36:10| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:37:11| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:37:34| squidaio_queue_request: WARNING – Queue congestion
    2008/11/27 13:38:12| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    2008/11/27 13:39:13| clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available

    我在网站查了资料,说是异步IO的线程太多的缘故,可是我设的不大呀,才16个,你有什么好办法吗?

    # /usr/local/squid/sbin/squid -v
    Squid Cache: Version 3.0.STABLE10
    configure options: ‘–prefix=/usr/local/squid’ ‘–enable-async-io=16′ ‘–enable-kill-parent-hack’ ‘–enable-poll’ ‘–enable-snmp’ ‘–disable-icmp’ ‘–disable-arp-acl’ ‘–disable-delay-pools’ ‘–disable-mem-gen-trace’ ‘–disable-ident-lookups’ ‘–disable-useragent-log’ ‘–enable-linux-netfilter’

  2. admin
    Nov 27th, 2008 at 14:43
    Reply | Quote | #2

    我没有出现过这个哦,不过我不建议使用3.0.我从网上帮你google了一下
    parseHttpRequest: NF getsockopt(SO_ORIGINAL_DST) failed: (92) Protocol not available
    这个错误提示,载入ip_conntrack这个内核模块就没有错误提示了。不载入这个模块,反向代理一样可用。
    模块ip_conntrack似乎会降低内核的网络吞吐速度。这就需要均衡一下了

  3. 骡骡
    Nov 27th, 2008 at 23:00
    Reply | Quote | #3

    谢谢,那你建议我换什么版本的? squid 2.6 ? OMG! 我的8个节点,刚从2.6升级到3.0,又得换回去吗?

  4. 骡骡
    Nov 30th, 2008 at 10:14
    Reply | Quote | #4

    # modprobe ip_conntrack

    谢谢,加载了ip_conntrack模块后,那个讨厌的报警在cache.log里没有再出现。

  5. tzh
    Dec 23rd, 2008 at 10:39
    Reply | Quote | #5

    扶凯老兄,以下问题帮忙看看!
    clientProcessHit: Vary object loop!
    varyEvaluateMatch: Oops. Not a Vary object on second attempt, ‘http://www.aaa.com/photo/zt/edit/‘ ‘accept-encoding=”gzip,%20deflate”‘

  6. admin
    Dec 26th, 2008 at 09:37
    Reply | Quote | #6

    有没有更加多的日志,这个看起来没有什么啊

  7. tzh
    Apr 9th, 2009 at 10:47
    Reply | Quote | #7

    提了些日志,帮忙看看
    clientProcessHit: Vary object loop!
    Apr 9 10:48:04 9-5 squid[21890]: varyEvaluateMatch: Oops. Not a Vary object on second attempt, ‘http://www.aaa.com/statics/footer_aaa_common.shtml‘ ‘accept-encoding=”gzip,%20deflate”‘
    Apr 9 10:48:04 9-5 squid[21890]: clientProcessHit: Vary object loop!