• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Erlang
  • License
    BSD 2-Clause "Sim...
  • Created almost 13 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Library implementing the SPDY protocol

Erlang SPDY

This is a library application designed to make it easy to add SPDY support to other erlang apps, specifically webservers like cowboy, misultin and mochiweb.

This app does contain a basic demo server which just returns a "Hello World" response to a GET / request received over SPDY. You should really use an existing server, or at least a more robust tcp listener/acceptor method.

To run the demo server:

$ rebar compile                            # compile everything
$ erl -pa ebin/ -boot start_sasl -s espdy  # espdy app doesn't run anything
erl> espdy_demo_server:start(6121, false). # start server, non-SSL (SPDY/2 only), OR
erl> espdy_demo_server_ssl:start(6121).    # start server, SSL (SPDY/3 and SPDY/2)

Please note that you should be running Erlang OTP R16B or later, as that was the first release that included the TLS Next Protocol Negotiation (NPN) functionality.

Current Status

The SSL demo server serves up a hardcoded page, and advertises NPN support for SPDY/3 and SPDY/2. It can serve either of these versions to Chrome or another compatible SPDY client.

The non-SSL demo server serves up the same hardcoded page, but only supports SPDY v2 sessions at the moment. This is because a bug in Chrome causes it to only use SPDY/2 in non-SSL mode.

There is no flow control, although that got pushed into SPDY/3 anyway.

Probably some other stuff to mention here.

Testing SPDY with Chrome

Run Chrome with these flags:

# Non-SSL mode
--use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo
# Or, with NPN/SSL:
--use-spdy=ssl --new-window --user-data-dir=/tmp/foo

This will open a new Chrome window:

  • with a new chrome profile, ignoring your existing settings
  • in SPDY-only mode - sites using normal HTTP will not load
  • force SPDY to not use SSL, for simpler testing (if you've opted for no-ssl)

Now go to http://localhost:6121/ in the new Chrome window.

You can view stats on Chrome's SPDY status at chrome://net-internals/#spdy However, it crashes with --use-spdy=no-ssl unless you have a very recent version. I'm testing with stunnel and https, and it works fine when Chrome is started with --use-spdy=ssl

OS X example

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo http://localhost:6121/

Linux example

chromium-browser --use-spdy=no-ssl --new-window --user-data-dir=/tmp/foo  http://localhost:6121/

Erlang SPDY Design Notes

This library is useful once you have accepted a socket that will be used for the SPDY protocol. Once accepted, you start a espdy_session process, providing a callback module. (See the demo server).

espdy_session will spawn a espdy_stream process for each new stream.

espdy_stream uses the callback module to respond to SPDY requests.

Two zlib contexts are maintained for each session. For inflating and deflating.

espdy_parser takes care of all the binary-to-record work and visa-versa, and requires a compression context to use.

As with other SPDY implementations, the server does not allow frames with different SPDY versions to be sent on the same session. The server will terminate the stream or session with the appropriate error message if a frame version mismatch is encountered.

Tests

EUnit tests are provided to verify the correct behavior of all binary encoding and decoding. However, there are not yet any tests for the session or stream management logic.

SPDY Resources

http://dev.chromium.org/spdy

Chrome supports SPDY v2 and v3 specs currently:

More Repositories

1

ketama

C library for consistent hashing, and langauge bindings
C
825
star
2

irccat

IRC bot that simplifies posting to IRC from shell scripts
Java
276
star
3

playdar-core

Playdar - a content resolver for music
PHP
192
star
4

relflow

Version-incrementing, appup-generating, relx-coaxing, workflow-assistant for Erlang projects using rebar3.
Erlang
92
star
5

estatsd

Erlang stats aggregation app that periodically flushes data to graphite
Erlang
88
star
6

playdar

Abandoned C++ codebase, see playdar-core repo!
C
49
star
7

heatmiser-neohub.py

Python library to talk the direct-lan-api to control a Heatmiser Neohub / Neostats - and home-assistant component
Python
31
star
8

erlang_rebar_example_project

Basic project using rebar, to demonstrate upgrades and packaging etc
Erlang
24
star
9

erlang-reup

Watches for .erl & .hrl changes, recompiles and reloads. You know, for development.
Erlang
24
star
10

erlang-cassandra-cql

cassandra driver in erlang that speaks native cassandra protocol
Erlang
22
star
11

mochiweb-websockets

***OBSOLETE, using my mochiweb repo now ***
Erlang
20
star
12

libf2f

Library for building p2p networks, C++ boost/asio
C++
16
star
13

libportfwd

Set up port fwds and find external IP: C++/CMake wrapper for miniupnpc and nat-pmp libs
C
14
star
14

greynet

A darknet/mesh network plugin for legacy C++ playdar codebase
C++
11
star
15

doorbird-mdns-vlan-subnet-bridge

Allow ios/android apps to discover and direct connect to doorbirds in a different subnet
Python
8
star
16

gocat

IRCCat in Go
Go
7
star
17

musickit

Qt+Webkit container app that exposes phonon/etc APIs to js
JavaScript
6
star
18

logtail

tail -f logfiles in a browser using websockets (erlang)
Erlang
6
star
19

sonos-shipping-forecast

Play the Shipping Forecast from BBC Radio 4, then return Sonos to original state.
Python
6
star
20

libmemcached

temporary repo for patching libmemcached
Shell
6
star
21

dotvim

my .vim
Vim Script
5
star
22

www.playdar.org

Playdar website
JavaScript
5
star
23

bevy_timewarp

A rollback library that buffers component state. Useful for netcode.
Rust
5
star
24

captainhook

Batch set github service hooks for all repos in an org
Python
4
star
25

vagrant-chef-basebox

Basic vagrant+chef setup
Ruby
4
star
26

estr-erlang-elixir-binary-string

Adaptor for using Elixir's UTF8 binary string module in Erlang
Erlang
3
star
27

bevy_naia_laminar

bevy plugin for laminar atop naia-socket
Rust
2
star
28

appupper

deprecated, see relflow:
Erlang
2
star
29

relsandbox

Release sandbox app (various changes, with appups)
Erlang
2
star
30

irccat-cookbook

chef cookbook for irccat
HTML
2
star
31

dot-janus

My .janus dir, containing vim config and plugins in addition to janus vim distro
Vim Script
2
star
32

erlang-countess

rebar3 release playground for blog post
Erlang
1
star
33

qdaapd

An embeddable C++/Qt DAAP server library
C
1
star
34

conjist

music network thing
C
1
star
35

radioblink

WIP - Circuit which takes the audio output of a PMR radio and blinks LEDs when it receives a signal
C
1
star
36

sharesight-custom-investment-price-updater

updates vg small cap price to sharesight
Rust
1
star