public
Created

How to set up ruby, eventmachine and spdy to use NPN

  • Download Gist
revspdynpn.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
#
# Get development tools installed
#
sudo yum install -y git cvs zlib-devel
sudo yum groupinstall -y "Development Tools"
 
#
# Install RVM
#
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
. .rvm/scripts/rvm
 
#
# Compile OpenSSL that has NPN support
#
mkdir openssl
cd openssl
mkdir openssl-dist
cvs -d anonymous@cvs.openssl.org:/openssl-cvs co openssl
#or wget ftp://ftp.openssl.org/snapshot/openssl-SNAP-20110425.tar.gz; tar xvzf openssl-SNAP-20110425.tar.gz; mv openssl-SNAP-20110425 openssl-src
mv openssl openssl-src
cd openssl-src
./config --prefix=$HOME/openssl/openssl-dist/
make depend
make install
cd ..
 
#
# Set up the environment to point to the NPN OpenSSL
#
cat >> openssl-env.sh <<EOF
export PATH=$HOME/openssl/openssl-dist/bin/:$PATH
export LD_LIBRARY_PATH=$HOME/openssl/openssl-dist/lib
export PKG_CONFIG_PATH=$HOME/openssl/openssl-dist/lib/pkgconfig
export CPATH=$HOME/openssl/openssl-dist/include
EOF
 
. openssl-env.sh
 
cd ..
 
#
# RVM install 1.9.2 pointing it to the custom openssl version
#
# If you have 1.9.2 installed already remove it first: rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/openssl/openssl-dist/
rvm use 1.9.2
 
#
# Install a handfull of gem deps needed later
#
gem install rake-compiler rspec bundler bindata ffi-zlib
 
#
# Install the NPN enabled event machine
#
git clone git://github.com/carsonmcdonald/eventmachine.git
cd eventmachine
git checkout tls-npn
rake gem
gem install pkg/eventmachine-1.0.0.beta.3.gem
cd ..
 
#
# Install spdy
#
git clone git://github.com/carsonmcdonald/spdy.git
cd spdy
git checkout npn
cd examples
ruby npn_spdy_server.rb
 
#
# You can now connect to the server on port 8000 using https. Using a browser without
# SPDY support you will see a non-spdy response and with support you will see a spdy
# response.
#

-fPIC needed on ubuntu

After building on ubuntu 11.10 using:
./config --prefix=$HOME/local/ shared -fPIC
and
rvm install 1.9.2-p180 -C --with-openssl-dir=$HOME/local

I get the exact same error as the base project every time chrome connects:
[:SPDY, :connection_closed]

It doesn't matter if i use --use-spdy=ssl or --use-spdy=no-ssl

Did chrome change its spdy implementation? Is this project out of date?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.