ユーザ用ツール

サイト用ツール


Sidebar

プロトコル系:spdy:spdylay

spdylay

SPDYのC実装のためのCライブラリ

macでビルド

コードクローン

git clone git://github.com/tatsuhiro-t/spdylay.git
cd spdylay/

必要なライブラリをbrewでインストール

brew install automake autoconf libtool libxml2 libevent cunit pkg-config 
brew tap homebrew/dupes
brew install zlib

pkgconfig微調整

一部pkgconfig用の.pcファイルがpkgconfigの参照ディレクトリにリンクが作られないので手動で作る

cd /usr/local/lib/pkgconfig
ln -s ../../Cellar/openssl/1.0.1e/lib/pkgconfig/openssl.pc openssl.pc
ln -s ../../Cellar/zlib/1.2.8/lib/pkgconfig/zlib.pc zlib.pc
cd -

ビルド

autoreconf -i
automake
autoconf
./configure
make

configureが大体こんな感じで通ればOK

    Version:        1.0.0 shared 5:0:0
    Host type:      x86_64-apple-darwin12.3.0
    Install prefix: /usr/local
    C compiler:     gcc
    CFLAGS:         -g -O2 -I/usr/local/Cellar/zlib/1.2.8/include 
    LDFLAGS:        
    LIBS:           -L/usr/local/Cellar/zlib/1.2.8/lib -lz  
    CPPFLAGS:       
    C preprocessor: gcc -E
    C++ compiler:   g++
    CXXFLAGS:       -g -O2
    CXXCPP:         g++ -E
    Library types:  Shared=yes, Static=yes
    CUnit:          yes
    OpenSSL:        yes
    Libxml2:        yes
    Libevent(SSL):  yes
    Src:            yes
    Examples:       yes

make後はexampleなバイナリを実行できたらOK

Register UnderflowはSPDY対応なので試してみた。

./src/spdycat -nv https://registerunderflow.org/
[  0.369] NPN select next protocol: the remote server offers:
          * spdy/2
          * http/1.1
          NPN selected the protocol: spdy/2
[  0.409] Handshake complete
[  0.410] send SYN_STREAM frame <version=2, flags=1, length=184>
          (stream_id=1, assoc_stream_id=0, pri=3)
          :host: registerunderflow.org
          :method: GET
          :path: /
          :scheme: https
          :version: HTTP/1.1
          accept: */*
          accept-encoding: gzip, deflate
          user-agent: spdylay/1.0.0
[  0.564] recv SETTINGS frame <version=2, flags=1, length=12>
          (niv=1)
          [4(1):100]
[  0.564] recv SYN_REPLY frame <version=2, flags=0, length=496>
          (stream_id=1)
          cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
          cache-control: max-age=0, no-cache
          content-encoding: gzip
          content-type: text/html; charset=utf-8
          date: Sun, 09 Jun 2013 16:00:47 GMT
          expires: Thu, 19 Nov 1981 08:52:00 GMT
          pragma: no-cache
          server: nginx/1.4.1
          set-cookie: bbs_session=cguogtb48r9ouicouin5pt4eh7; path=/
          set-cookie: bbs_session=oknrkvrmmktrjdg6teu20cn675; path=/
          :status: 200
          :version: HTTP/1.1
          x-page-speed: 1.4.0.0-2748
          x-powered-by: PHP/5.4.13
[  0.600] recv DATA frame (stream_id=1, flags=1, length=9917)
[  0.600] send GOAWAY frame <version=2, flags=0, length=4>
          (last_good_stream_id=0)

Googleさん**spdy/4a2**を準備してらっしゃる

$ ./src/spdycat -nv https://www.google.co.jp/
[  0.050] NPN select next protocol: the remote server offers:
          * spdy/4a2
          * spdy/3
          * spdy/2
          * http/1.1
          NPN selected the protocol: spdy/3
[  0.069] Handshake complete
[  0.069] recv SETTINGS frame <version=3, flags=0, length=20>
          (niv=2)
          [4(1):100]
          [7(0):65536]
[  0.069] send SYN_STREAM frame <version=3, flags=1, length=219>
          (stream_id=1, assoc_stream_id=0, pri=3)
          :host: www.google.co.jp
          :method: GET
          :path: /
          :scheme: https
          :version: HTTP/1.1
          accept: */*
          accept-encoding: gzip, deflate
          user-agent: spdylay/1.0.0
[  0.129] recv SYN_REPLY frame <version=3, flags=0, length=547>
          (stream_id=1)
          :status: 200 OK
          :version: HTTP/1.1
          cache-control: private, max-age=0
          content-type: text/html; charset=Shift_JIS
          date: Sun, 09 Jun 2013 16:07:12 GMT
          expires: -1
          p3p: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
          server: gws
          set-cookie: PREF=ID=94d36b13d3d0bb79:FF=0:TM=1370794032:LM=1370794032:S=Re9jvlZIxwbSMJoe; expires=Tue, 09-Jun-2015 16:07:12 GMT; path=/; domain=.google.co.jp
          set-cookie: NID=67=ZaGZAva2Rtp2p4WhYkTGMVabdccyGV5rU1CZX_9ojNLDOxMlj1um6Jy-NmxbD2P1tno2CBnO4jXCgWg_9Zqi-HwO4--pqbnwg4-ItDtia01xicXG9Xym_DDE7d2l7PGd; expires=Mon, 09-Dec-2013 16:07:12 GMT; path=/; domain=.google.co.jp; HttpOnly
          x-frame-options: SAMEORIGIN
          x-xss-protection: 1; mode=block
[  0.131] recv DATA frame (stream_id=1, flags=1, length=11108)
[  0.131] send GOAWAY frame <version=3, flags=0, length=8>
          (last_good_stream_id=0)

cooooool!

プロトコル系/spdy/spdylay.txt · 最終更新: 2013/06/10 01:08 by matsumoto_r