Giter Club home page Giter Club logo

spdylay's Issues

shrpx client mode and haproxy's health check

Configured haproxy like below:

backend nas
mode http
option httpchk GET / HTTP/1.1\r\nHost:\ www
http-check expect rstatus 404|400|407
server test 127.0.0.1:89 #shrpx client

but when shrpx SPDY proxy server dead, client side still return 400 error code to haproxy, so the health check failed.

Is it correct to returen 5XX instead of 4XX when server side error, for example, server's shrpx or squid exit unexpected.

shrpx does not send entire certificate chain?

I've been testing shrpx with Chrome and Firefox, and Firefox is complaining about the SSL certificate. From what I can understand, shrpx appears not to be sending the full certificate chain (even though I've pointed it to a file where I concatenated the site certificate, the intermediate certificate and the ca certificate).

What I can see in Firefox is that it receives the site certificate only.

Do I need to do anything special to get this to work?

Timeout Config for Long-Pulling Sessions

First, thanks for writing the C library, which is very efficient compared to libraries in higher-level languages.

I wonder what are your thoughts on the timeout config for the long-pulling websites, when used as a forward proxy.

When browsing G+, I did experience hanging on a certain requests. Then the website won't respond to my subsequent clicks on other links, unless I reload the webpage. Not sure if related.

spdy client without TSL

Hi,

I have a testing task using spdy for comparison, for efficiency consideration, I should use spdy without ssl, could anyone tell me how to disable the TSL in the client? Your help is greatly appreciated.

BR

Add support for basic authentication to shrpx

Hello, I want to setup shrpx at my VPS and access it through chrome from my desktop computer, so there must be some access restrict. I think http basic authentication maybe is the simplest way. Here is the document of spdy authentication: http://www.chromium.org/spdy/spdy-authentication

We should reply "407 Proxy Authentication Required" when the client didn't send "Proxy-Authenticate" header in the syn request, and the client then retries the request with a Proxy-Authorization header, and we will check the username and password whether they are correct.

make error in centos5.5

./configure --prefix=/usr/local/spdylay OPENSSL_CFLAGS=-I/usr/local/ssl/include OPENSSL_LIBS="-L/usr/local/ssl/lib -lssl -lcrypto" LIBEVENT_OPENSSL_CFLAGS=-I/usr/local/libevent2/include LIBEVENT_OPENSSL_LIBS="-L/usr/local/libevent2/lib -lssl -lcrypto"

make

shrpx_listen_handler.o: In function shrpx::ListenHandler::create_worker_thread(unsigned int)': /root/src/spdylay-0.3.8/src/shrpx_listen_handler.cc:84: undefined reference tobufferevent_socket_new'
shrpx_listen_handler.o: In function shrpx::ListenHandler::accept_connection(int, sockaddr*, int)': /root/src/spdylay-0.3.8/src/shrpx_listen_handler.cc:111: undefined reference tobufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_listen_handler.cc:112: undefined reference to evbuffer_add' shrpx_client_handler.o: In functionshrpx::ClientHandler::get_pending_write_length()':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:293: undefined reference to bufferevent_get_output' shrpx_client_handler.o: In functionshrpx::ClientHandler::set_bev_cb(void ()(bufferevent, void_), void ()(bufferevent, void_), void ()(bufferevent, short, void_))':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:188: undefined reference to bufferevent_setcb' shrpx_client_handler.o: In function~ClientHandler':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:152: undefined reference to bufferevent_disable' /root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:153: undefined reference tobufferevent_free'
shrpx_client_handler.o: In function ClientHandler': /root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:131: undefined reference tobufferevent_enable'
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:132: undefined reference to bufferevent_setwatermark' /root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:131: undefined reference tobufferevent_enable'
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:132: undefined reference to bufferevent_setwatermark' shrpx_client_handler.o: In function~ClientHandler':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:152: undefined reference to bufferevent_disable' /root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:153: undefined reference tobufferevent_free'
shrpx_client_handler.o: In function shrpx::(anonymous namespace)::upstream_writecb(bufferevent_, void_)': /root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:56: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:56: undefined reference toevbuffer_get_length' shrpx_client_handler.o: In function shrpx::ClientHandler::get_pending_write_length()':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:294: undefined reference toevbuffer_get_length' shrpx_client_handler.o: In function shrpx::ClientHandler::set_upstream_timeouts(timeval const_, timeval const_)':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:194: undefined reference to bufferevent_set_timeouts' shrpx_client_handler.o: In functionshrpx::ClientHandler::get_evbase() const':
/root/src/spdylay-0.3.8/src/shrpx_client_handler.cc:181: undefined reference to bufferevent_get_base' shrpx_spdy_upstream.o: In functionshrpx::(anonymous namespace)::spdy_downstream_writecb(bufferevent_, void_)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:508: undefined reference to bufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:508: undefined reference toevbuffer_get_length'
shrpx_spdy_upstream.o: In function shrpx::(anonymous namespace)::recv_callback(spdylay_session_, unsigned char_, unsigned int, int, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:80: undefined reference to bufferevent_get_input'
/root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:81: undefined reference toevbuffer_remove' shrpx_spdy_upstream.o: In function shrpx::(anonymous namespace)::send_callback(spdylay_session*, unsigned char const*, unsigned int, int, void*)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:57: undefined reference tobufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:59: undefined reference to evbuffer_get_length'
/root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:63: undefined reference toevbuffer_add' shrpx_spdy_upstream.o: In function shrpx::SpdyUpstream::on_downstream_body(shrpx::Downstream*, unsigned char const*, unsigned int)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:852: undefined reference toevbuffer_add' /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:859: undefined reference to evbuffer_get_length'
shrpx_spdy_upstream.o: In functionshrpx::(anonymous namespace)::spdy_data_read_callback(spdylay_session_, int, unsigned char_, unsigned int, int_, spdylay_data_source_, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:675: undefined reference to evbuffer_remove'
shrpx_spdy_upstream.o: In functionshrpx::SpdyUpstream::error_reply(shrpx::Downstream_, int)': /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:705: undefined reference to evbuffer_add'
shrpx_spdy_upstream.o: In functionshrpx::(anonymous namespace)::spdy_downstream_eventcb(bufferevent_, short, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_upstream.cc:531: undefined reference to bufferevent_getfd'
shrpx_https_upstream.o: In functionshrpx::(anonymous namespace)::https_downstream_writecb(bufferevent_, void_)': /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:459: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:459: undefined reference toevbuffer_get_length' shrpx_https_upstream.o: In function shrpx::HttpsUpstream::on_downstream_body_complete(shrpx::Downstream*)':
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:731: undefined reference tobufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:732: undefined reference to evbuffer_add'
shrpx_https_upstream.o: In functionshrpx::HttpsUpstream::on_downstream_body(shrpx::Downstream_, unsigned char const_, unsigned int)': /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:705: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:710: undefined reference toevbuffer_add' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:715: undefined reference to evbuffer_add'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:720: undefined reference toevbuffer_add' shrpx_https_upstream.o: In function shrpx::HttpsUpstream::error_reply(int)':
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:568: undefined reference tobufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:569: undefined reference to evbuffer_add'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:569: undefined reference toevbuffer_add' shrpx_https_upstream.o: In function shrpx::(anonymous namespace)::https_downstream_readcb(bufferevent*, void*)':
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:427: undefined reference tobufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:427: undefined reference to evbuffer_get_length'
shrpx_https_upstream.o: In functionshrpx::HttpsUpstream::on_read()': /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:260: undefined reference to bufferevent_get_input'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:262: undefined reference toevbuffer_pullup' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:264: undefined reference to evbuffer_get_length'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:270: undefined reference toevbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:271: undefined reference to evbuffer_drain'
shrpx_https_upstream.o: In functionshrpx::HttpsUpstream::on_downstream_header_complete(shrpx::Downstream_)': /root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:689: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:690: undefined reference toevbuffer_add' shrpx_https_upstream.o: In function shrpx::(anonymous namespace)::htp_hdrs_completecb(http_parser_)':
/root/src/spdylay-0.3.8/src/shrpx_https_upstream.cc:179: undefined reference to bufferevent_write' shrpx_downstream.o: In functionshrpx::Downstream::init_response_body_buf()':
/root/src/spdylay-0.3.8/src/shrpx_downstream.cc:442: undefined reference to evbuffer_new' /root/src/spdylay-0.3.8/src/shrpx_downstream.cc:446: undefined reference toevbuffer_setcb'
shrpx_downstream.o: In function ~Downstream': /root/src/spdylay-0.3.8/src/shrpx_downstream.cc:71: undefined reference toevbuffer_free'
/root/src/spdylay-0.3.8/src/shrpx_downstream.cc:71: undefined reference to evbuffer_free' shrpx_http_downstream_connection.o: In functionshrpx::HttpDownstreamConnection::get_output_buffer_full()':
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:345: undefined reference to bufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:346: undefined reference toevbuffer_get_length'
shrpx_http_downstream_connection.o: In function ~HttpDownstreamConnection': /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:57: undefined reference tobufferevent_disable'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:58: undefined reference to bufferevent_free' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:57: undefined reference tobufferevent_disable'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:58: undefined reference to bufferevent_free' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:57: undefined reference tobufferevent_disable'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:58: undefined reference to bufferevent_free' shrpx_http_downstream_connection.o: In functionshrpx::HttpDownstreamConnection::on_read()':
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:443: undefined reference to bufferevent_get_input' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:444: undefined reference toevbuffer_pullup'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:448: undefined reference to evbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:450: undefined reference toevbuffer_drain'
shrpx_http_downstream_connection.o: In function shrpx::HttpDownstreamConnection::end_upload_data()': /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:263: undefined reference tobufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:264: undefined reference to evbuffer_add' shrpx_http_downstream_connection.o: In functionshrpx::HttpDownstreamConnection::push_upload_data_chunk(unsigned char const_, unsigned int)':
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:231: undefined reference to bufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:237: undefined reference toevbuffer_add'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:243: undefined reference to evbuffer_add' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:250: undefined reference toevbuffer_add'
shrpx_http_downstream_connection.o: In function shrpx::HttpDownstreamConnection::attach_downstream(shrpx::Downstream_)': /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:100: undefined reference to bufferevent_setwatermark'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:101: undefined reference tobufferevent_enable' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:105: undefined reference to bufferevent_setcb'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:110: undefined reference tobufferevent_set_timeouts' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:77: undefined reference to bufferevent_socket_new'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:82: undefined reference tobufferevent_socket_connect' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:84: undefined reference to bufferevent_free'
shrpx_http_downstream_connection.o: In functionshrpx::HttpDownstreamConnection::detach_downstream(shrpx::Downstream_)': /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:313: undefined reference to bufferevent_enable'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:314: undefined reference tobufferevent_setcb' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:319: undefined reference to bufferevent_set_timeouts'
shrpx_http_downstream_connection.o: In functionshrpx::HttpDownstreamConnection::push_request_headers()': /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:205: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:207: undefined reference toevbuffer_add' /root/src/spdylay-0.3.8/src/shrpx_http_downstream_connection.cc:220: undefined reference to bufferevent_set_timeouts'
shrpx_spdy_downstream_connection.o: In functionshrpx::SpdyDownstreamConnection::get_output_buffer_full()': /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:453: undefined reference to evbuffer_get_length'
shrpx_spdy_downstream_connection.o: In functionshrpx::(anonymous namespace)::spdy_data_read_callback(spdylay_session_, int, unsigned char_, unsigned int, int_, spdylay_data_source_, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:180: undefined reference to evbuffer_remove'
/root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:198: undefined reference toevbuffer_get_length' shrpx_spdy_downstream_connection.o: In function shrpx::SpdyDownstreamConnection::init_request_body_buf()':
/root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:86: undefined reference toevbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:86: undefined reference to evbuffer_drain'
/root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:91: undefined reference toevbuffer_new' /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:95: undefined reference to evbuffer_setcb'
shrpx_spdy_downstream_connection.o: In functionshrpx::SpdyDownstreamConnection::push_upload_data_chunk(unsigned char const_, unsigned int)': /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:365: undefined reference to evbuffer_add'
shrpx_spdy_downstream_connection.o: In function~SpdyDownstreamConnection': /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:63: undefined reference to evbuffer_free'
/root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:63: undefined reference toevbuffer_free' /root/src/spdylay-0.3.8/src/shrpx_spdy_downstream_connection.cc:63: undefined reference to evbuffer_free'
shrpx_spdy_session.o: In functionshrpx::SpdySession::notify()': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:1144: undefined reference to bufferevent_write'
shrpx_spdy_session.o: In functionshrpx::SpdySession::clear_notify()': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:1136: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:1137: undefined reference toevbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:1137: undefined reference to evbuffer_drain'
shrpx_spdy_session.o: In functionshrpx::(anonymous namespace)::recv_callback(spdylay_session_, unsigned char_, unsigned int, int, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:659: undefined reference to bufferevent_get_input'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:660: undefined reference toevbuffer_remove' shrpx_spdy_session.o: In function shrpx::SpdySession::on_read_proxy()':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:504: undefined reference tobufferevent_get_input' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:505: undefined reference to evbuffer_pullup'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:509: undefined reference toevbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:511: undefined reference to evbuffer_drain'
shrpx_spdy_session.o: In functionshrpx::SpdySession::unwrap_free_bev()': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:465: undefined reference to bufferevent_getfd'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:466: undefined reference tobufferevent_free' shrpx_spdy_session.o: In function shrpx::(anonymous namespace)::send_callback(spdylay_session*, unsigned char const*, unsigned int, int, void*)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:636: undefined reference tobufferevent_get_output' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:638: undefined reference to evbuffer_get_length'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:642: undefined reference toevbuffer_add' shrpx_spdy_session.o: In function shrpx::SpdySession::init_notification()':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:194: undefined reference tobufferevent_socket_new' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:204: undefined reference to bufferevent_socket_new'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:210: undefined reference tobufferevent_enable' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:211: undefined reference to bufferevent_setcb'
shrpx_spdy_session.o: In functionshrpx::SpdySession::disconnect()': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:81: undefined reference to bufferevent_getfd'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:82: undefined reference tobufferevent_disable' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:83: undefined reference to bufferevent_free'
shrpx_spdy_session.o: In functionshrpx::(anonymous namespace)::writecb(bufferevent_, void_)': /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:230: undefined reference to bufferevent_get_output'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:230: undefined reference toevbuffer_get_length' shrpx_spdy_session.o: In function shrpx::(anonymous namespace)::proxy_eventcb(bufferevent*, short, void*)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:331: undefined reference tobufferevent_write' shrpx_spdy_session.o: In function shrpx::(anonymous namespace)::eventcb(bufferevent*, short, void*)':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:257: undefined reference tobufferevent_getfd' shrpx_spdy_session.o: In function shrpx::SpdySession::initiate_connection()':
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:367: undefined reference tobufferevent_socket_new' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:368: undefined reference to bufferevent_enable'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:370: undefined reference tobufferevent_set_timeouts' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:374: undefined reference to bufferevent_setcb'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:378: undefined reference tobufferevent_socket_connect' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:441: undefined reference to bufferevent_free'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:415: undefined reference tobufferevent_openssl_socket_new' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:427: undefined reference to bufferevent_socket_connect'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:446: undefined reference tobufferevent_setwatermark' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:447: undefined reference to bufferevent_enable'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:448: undefined reference tobufferevent_setcb' /root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:431: undefined reference to bufferevent_socket_new'
/root/src/spdylay-0.3.8/src/shrpx_spdy_session.cc:423: undefined reference tobufferevent_socket_new' shrpx_io_control.o: In function shrpx::IOControl::force_resume_read()':
/root/src/spdylay-0.3.8/src/shrpx_io_control.cc:69: undefined reference tobufferevent_enable' shrpx_io_control.o: In function shrpx::IOControl::resume_read(shrpx::IOCtrlReason)':
/root/src/spdylay-0.3.8/src/shrpx_io_control.cc:57: undefined reference tobufferevent_enable' shrpx_io_control.o: In function shrpx::IOControl::pause_read(shrpx::IOCtrlReason)':
/root/src/spdylay-0.3.8/src/shrpx_io_control.cc:48: undefined reference tobufferevent_disable' shrpx_ssl.o: In function shrpx::ssl::accept_connection(event_base*, ssl_ctx_st*, int, sockaddr*, int)':
/root/src/spdylay-0.3.8/src/shrpx_ssl.cc:278: undefined reference tobufferevent_openssl_socket_new' /root/src/spdylay-0.3.8/src/shrpx_ssl.cc:280: undefined reference to bufferevent_socket_new'
shrpx_thread_event_receiver.o: In functionshrpx::ThreadEventReceiver::on_read(bufferevent_)': /root/src/spdylay-0.3.8/src/shrpx_thread_event_receiver.cc:46: undefined reference to bufferevent_get_input'
/root/src/spdylay-0.3.8/src/shrpx_thread_event_receiver.cc:47: undefined reference toevbuffer_get_length' /root/src/spdylay-0.3.8/src/shrpx_thread_event_receiver.cc:49: undefined reference to evbuffer_remove'
/root/src/spdylay-0.3.8/src/shrpx_thread_event_receiver.cc:59: undefined reference tobufferevent_get_base' shrpx_worker.o: In function shrpx::Worker::run()':
/root/src/spdylay-0.3.8/src/shrpx_worker.cc:74: undefined reference toevent_base_new' /root/src/spdylay-0.3.8/src/shrpx_worker.cc:76: undefined reference to bufferevent_socket_new'
/root/src/spdylay-0.3.8/src/shrpx_worker.cc:85: undefined reference tobufferevent_enable' /root/src/spdylay-0.3.8/src/shrpx_worker.cc:86: undefined reference to bufferevent_setcb'
/root/src/spdylay-0.3.8/src/shrpx_worker.cc:88: undefined reference toevent_base_loop' shrpx.o: In function shrpx::(anonymous namespace)::create_evlistener(shrpx::ListenHandler_, int)':
/root/src/spdylay-0.3.8/src/shrpx.cc:165: undefined reference to evutil_make_socket_nonblocking' /root/src/spdylay-0.3.8/src/shrpx.cc:209: undefined reference toevconnlistener_new'
/root/src/spdylay-0.3.8/src/shrpx.cc:210: undefined reference to evconnlistener_set_error_cb' shrpx.o: In functionshrpx::(anonymous namespace)::event_loop()':
/root/src/spdylay-0.3.8/src/shrpx.cc:238: undefined reference to event_base_new' /root/src/spdylay-0.3.8/src/shrpx.cc:283: undefined reference toevent_base_loop'
/root/src/spdylay-0.3.8/src/shrpx.cc:285: undefined reference to evconnlistener_free' /root/src/spdylay-0.3.8/src/shrpx.cc:288: undefined reference toevconnlistener_free'
collect2: ld returned 1 exit status
make[2]: *** [shrpx] Error 1
make[2]: Leaving directory /root/src/spdylay-0.3.8/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/root/src/spdylay-0.3.8'
make: *** [all] Error 2

does not build for mac lion

I have installed pkg-config with brew install pkg-config.
pkg-config-0.27 already installed
pkgconfig @0.27 devel/pkgconfig

checking whether make sets $(MAKE)... (cached) yes
./configure: line 15729: syntax error near unexpected token 0.20' ./configure: line 15729:PKG_PROG_PKG_CONFIG(0.20)'

wrong format passed to printf

int spdylay_ssl.cc:

void print_timer()
{
  timeval tv;
  get_timer(&tv);
  printf("%s[%3ld.%03ld]%s",
         ansi_esc("\033[33m"),
         tv.tv_sec, tv.tv_usec/1000,
         ansi_escend());
}

The type of "tv.tv_usec" is suseconds_t, in some platform(e.g.Linux) it is 8 bytes and some platform(e.g. Mac OS X) it is 4 bytes.

#include <iostream>
#include <sys/time.h>

#include <typeinfo>
#include <cxxabi.h>
#include <stdlib.h>



int main(){
  std::cout<<"sizeof(suseconds_t)="<<sizeof(suseconds_t)<<std::endl;

  int status;
  char *realname = abi::__cxa_demangle(typeid(suseconds_t).name(), 0, 0, &status);
  std::cout<<realname<<std::endl;
  free(realname);
  return 0;
}

$ clang++ -o t test.cpp
$ ./t
sizeof(suseconds_t)=4
int
$ file t
t: Mach-O 64-bit executable x86_64

Incorrect test for event.udata being intptr_t

On OS X with gcc == i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 the following code check for event.udata being an intptr_t:


#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>

int
main ()
{
  struct kevent event;
  event.udata = (intptr_t*)(&event);
  ;
  return 0;
}

I believe the proper check should be:

event.udata = (intptr_t)(&event);

Or something similar. The current check as written passes when event.udata us a void*.

In EventPoll_kqueue.cc the following #ifdef block is used:

#ifdef KEVENT_UDATA_INTPTR_T
# define PTR_TO_UDATA(X) (reinterpret_cast<intptr_t>(X))
#else // !KEVENT_UDATA_INTPTR_T
# define PTR_TO_UDATA(X) (X)
#endif // !KEVENT_UDATA_INTPTR_T

Since KEVENT_UDATA_INTPTR_T is set to 1 by the configure check, the:

PTR_TO_UDATA(user_data)

in update_event becomes:

reinterpret_cast<intptr_t>(user_data)

And results in the following error:

error: invalid conversion from ‘intptr_t’ to ‘void*’

shrpx forward proxy support?

I tried to use shrpx to forward proxy traffic, but without success. Backend is a Squid forward HTTP proxy, shrpx turn it into a SPDY proxy which Chrome browser supported.

Client streams are not resetable

It is not possible to reset in progress streams from the client at the moment. The reason is that a client calls
spdylay_submit_request with some stream user data. The users callbacks get the stream user data to pass information to the client. However, the stream id is needed to call spdylay_submit_rst_stream.

I'm currently hacking around this by setting the stream id on my stream user data object in my request body callback and the syn_reply callback.

This means that for bodiless requests can't be cancelled between sending a request and getting the first control header for the response.

I think the solution would be to return the stream_id from submit_request.

2 way auth for shrpx

It would be useful to add 2 way auth for shrpx, in client mode, verify client side's certificate.

it can not works as secure SPDY proxy

Hi,
I read the document and try to use "-s" let shrpx works as SPDY proxy but faild:

./shrpx -s /root/cert_test/ws1.key /root/cert_test/ws1.crt

I go to chrome and config the spdy proxy,I try to visit google but got a error:

502 Bad Gateway

shrpx spdylay/0.3.8 at port 3000

python wrapper does not build

Hi,
I built spdylay client and so far working perfectly.
I am trying to build python bindings following the instruction python setup.py build_ext, I got the error that spdylay.c not find.
I grepped files under top root, could not find it either.
Any idea why spdylay.c is missing from the python directory ?

build error:

running build_ext
building 'spdylay' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c spdylay.c -o build/temp.macosx-10.7-intel-2.7/spdylay.o
i686-apple-darwin11-llvm-gcc-4.2: spdylay.c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: no input files
i686-apple-darwin11-llvm-gcc-4.2: spdylay.c: No such file or directory
i686-apple-darwin11-llvm-gcc-4.2: no input files
lipo: can't figure out the architecture type of: /var/folders/hg/373yfnq53m37_3fldlg86hth1wcwgs/T//ccwvXIjn.out

spdylay.h missing sys/types.h

diff --git a/lib/includes/spdylay/spdylay.h b/lib/includes/spdylay/spdylay.h
index d71cbb7..178bd5e 100644
--- a/lib/includes/spdylay/spdylay.h
+++ b/lib/includes/spdylay/spdylay.h
@@ -31,6 +31,7 @@ extern "C" {

#include <stdlib.h>
#include <stdint.h>
+#include <sys/types.h>

struct spdylay_session;
typedef struct spdylay_session spdylay_session;

build error on ubuntu 10.04 (lucid)

/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I./includes -I./includes -Wall -g -O2 -MT spdylay_session.lo -MD -MP -MF .deps/spdylay_session.Tpo -c -o spdylay_session.lo spdylay_session.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I./includes -I./includes -Wall -g -O2 -MT spdylay_session.lo -MD -MP -MF .deps/spdylay_session.Tpo -c spdylay_session.c -fPIC -DPIC -o .libs/spdylay_session.o
In file included from spdylay_session.c:25:
spdylay_session.h:123: error: redefinition of typedef 'spdylay_session'
./includes/spdylay/spdylay.h:36: note: previous declaration of 'spdylay_session' was here
spdylay_session.c: In function 'spdylay_outbound_item_free':
spdylay_session.c:133: warning: enumeration value 'SPDYLAY_SETTINGS' not handled in switch
spdylay_session.c: In function 'spdylay_session_add_frame':
spdylay_session.c:198: warning: enumeration value 'SPDYLAY_SETTINGS' not handled in switch
spdylay_session.c: In function 'spdylay_session_after_frame_sent':
spdylay_session.c:541: error: 'CLOCK_MONOTONIC_RAW' undeclared (first use in this function)
spdylay_session.c:541: error: (Each undeclared identifier is reported only once
spdylay_session.c:541: error: for each function it appears in.)
spdylay_session.c:478: warning: enumeration value 'SPDYLAY_SETTINGS' not handled in switch
spdylay_session.c: In function 'spdylay_session_on_ping_received':
spdylay_session.c:872: error: 'CLOCK_MONOTONIC_RAW' undeclared (first use in this function)
make[3]: *** [spdylay_session.lo] Error 1
make[3]: Leaving directory /home/gdewan/tatsuhiro-t-spdylay-826cd6a/lib' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory/home/gdewan/tatsuhiro-t-spdylay-826cd6a/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gdewan/tatsuhiro-t-spdylay-826cd6a'
make: *** [all] Error 2
gdewan@sfo-lpwng:~/tatsuhiro-t-spdylay-826cd6a$

check_response_header assert(3)s when mod_spdy pushes anything

When I point spdycat at a site using apache+mod_spdy, which pushes associated content, there is an invariable assert(3) in check_response_header() in the next frame (a SYN_HEADERS fram) after the SYN_REPLY frame which contains the requested body.

W/o associated content, it goes:

[ 0.256] NPN select next protocol: the remote server offers:
[ 0.386] send SYN_STREAM frame <version=3, flags=1, length=185>
[ 0.501] recv SETTINGS frame <version=3, flags=0, length=12>
[ 0.522] recv SYN_REPLY frame <version=3, flags=0, length=147>
[ 0.523] recv DATA frame (stream_id=1, flags=1, length=44)
[ 0.523] send GOAWAY frame <version=3, flags=0, length=8>
(last_good_stream_id=0)

With associated content (in this case pushing four images and one css), it goes:

[ 0.251] NPN select next protocol: the remote server offers:
[ 0.375] send SYN_STREAM frame <version=3, flags=1, length=183>
[ 0.490] recv SETTINGS frame <version=3, flags=0, length=12>
[ 0.493] recv SYN_STREAM frame <version=3, flags=2, length=74>
[ 0.494] recv SYN_STREAM frame <version=3, flags=2, length=33>
[ 0.494] recv SYN_STREAM frame <version=3, flags=2, length=29>
[ 0.494] recv SYN_STREAM frame <version=3, flags=2, length=24>
[ 0.605] recv SYN_STREAM frame <version=3, flags=2, length=25>
[ 0.606] recv SYN_REPLY frame <version=3, flags=0, length=141>
[ 0.606] recv DATA frame (stream_id=1, flags=1, length=1356)

and then assert(3)s, so the next fram (I presume a GOAWAY?) isn’t processed or reported.

I see that the lengths, as reported in the verbose output, of the SYN_STREAM frames are not indicative of the sizes of the associated files or of their URIs. I don’t know whether that is relevant.

Gdb tells me that check_response_header() is called with type=SPDYLAY_HEADERS,
frame is:

$5 = {ctrl = {hd = {version = 3, type = 8, flags = 0 '\000', length = 120}}, syn_stream = {
hd = {version = 3, type = 8, flags = 0 '\000', length = 120}, stream_id = 2,
assoc_stream_id = 6550624, pri = 0 '\000', slot = 0 '\000',
nv = 0x40aa25 <spdylay::recv_callback(spdylay_session*, unsigned char*, unsigned long, int, void*)+58>}, syn_reply = {hd = {version = 3, type = 8, flags = 0 '\000', length = 120},
stream_id = 2, nv = 0x63f460}, rst_stream = {hd = {version = 3, type = 8,
flags = 0 '\000', length = 120}, stream_id = 2, status_code = 6550624}, settings = {
hd = {version = 3, type = 8, flags = 0 '\000', length = 120}, niv = 6550624,
iv = 0x40aa25 <spdylay::recv_callback(spdylay_session*, unsigned char*, unsigned long, int, void*)+58>}, ping = {hd = {version = 3, type = 8, flags = 0 '\000', length = 120},
unique_id = 2}, goaway = {hd = {version = 3, type = 8, flags = 0 '\000', length = 120},
last_good_stream_id = 2, status_code = 6550624}, headers = {hd = {version = 3, type = 8,
flags = 0 '\000', length = 120}, stream_id = 2, nv = 0x63f460}, window_update = {hd = {
version = 3, type = 8, flags = 0 '\000', length = 120}, stream_id = 2,
delta_window_size = 6550624}, credential = {hd = {version = 3, type = 8, flags = 0 '\000',
length = 120}, slot = 2, proof = {data = 0x63f460 "\b\365c", length = 4237861},
certs = 0x14, ncerts = 140737488331984}}

If I add a return in the SYN_HEADERS if clause, it works and reports the headers and data frames of each of the associated URIs.

Add API to manually send WINDOW_UPDATE frame

The current implementation automatically sends back WINDOW_UPDATE after certain amount of DATA are received.
This works fine for endpoint like web-server or browser but it is not desirable for proxy, because it may want to send WINDOW_UPDATE after it relayed the data to the opposite endpoint. For this purpose, we need manual sending of WINDOW_UPDATE.

Multi-core configuration

I am playing around shrpx. It works great, btw.

One of the config option is the number of the workers. I assume the master thread will create the specified number of workers, trying to situate each worker on a different core of cpu. The master thread then will distribute the traffic to each worker, in a "sticky" way of loan-balancing. Is that correct?

Some back-end servers do multi-threading in a similar way -- it seems to be a popular way these days. Each thread will listen on a dedicated port , e.g. Foreman, Squid.

It looks natural to align the shrpx's workers and the back-end server's workers, in order to avoid an additional dispatcher (in front of back-end servers).

Do you have suggestions on this?

spdylay client submit reset frame after about 200 push streams

During my stress test, I continuously push data to spdy client.
After about 200 pushes, spdylay client sends reset frame to the server.

This is consistently happen for several tests.

on data chunk recv: stream id 203
before control frame send: frame type: 3 // SPDYLAY_RST_STREAM = 3,

Is there a hard code setting on the max push streams ?

failmalloc test fails and exits with zero status

spdylay/tests$ ./failmalloc

 CUnit - A unit testing framework for C - Version 2.1-2
 http://cunit.sourceforge.net/

Suite: libspdylay_TestSuite
Test: failmalloc_session_send ...passed
Test: failmalloc_session_recv ...passed
Test: failmalloc_frame ...FAILED
1. spdylay_test_helper.c:49 - rv >= 0
2. spdylay_test_helper.c:49 - rv >= 0

Run Summary: Type Total Ran Passed Failed Inactive
suites 1 1 n/a 0 0
tests 3 3 2 1 0
asserts 4 4 2 2 n/a

Elapsed time = 0.003 seconds
jim@Jims-MacBook-Air:~/git/t0/spdylay/tests$ echo $?
0

This means that make check succeeds even though the test fails.

configure error

Hi tatsuhiro-t,

I'm trying to compile spdylay on ubuntu 11.10, and I'm getting this error then running ./configure:

checking whether g++ accepts -g... no
checking dependency style of g++... none
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
./configure: line 15706: syntax error near unexpected token 0.20' ./configure: line 15706:PKG_PROG_PKG_CONFIG(0.20)'

Michael

Unable to build Python extension module (spdylay.c: No such file or directory)

I compiled and installed Spdylay library (in the standard location) with success, I'm also able to compile the examples and custom programs, but when I try to build the Python extension module I get:

$ python setup.py build_ext
running build_ext
building 'spdylay' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c spdylay.c -o build/temp.linux-x86_64-2.7/spdylay.o
gcc: error: spdylay.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
error: command 'gcc' failed with exit status 4

And indeed spdylay.c is not in that folder and neither in my whole file system (including this repo).

Support Gvent

May spdylay-python will support gevent?
Gevent has a monkey patch feature, which can convert a program from multi-threaded to multi-greenlet.So we will get a better performance.
Thanks.

`shrpx --client-proxy' behind a transparent proxy

Moving from #31 .

In a following situation, where the client is behind a transparent proxy often seen in a corporate environment,

[ < client/chrome > <--> < proxy > ] <===> [ < shrpx > <--> < squid > ] ] <===> < google.com >

I think a possible solution is to let `shrpx --client-proxy' support a transparent proxy.

[ < client/chrome > <--> < shrpx --client-proxy > <--> < proxy > ] <===> [ < shrpx > <--> < squid > ] ] <===> < google.com >

What do you think?

Timeout on spdycat does not work

No matter if I specify a timeout or not, or how long it is it does not time out and waits the network to fail (about 70-80 seconds).

Control/Data Flags not passed to send_callback in spdylay_session_send

https://github.com/tatsuhiro-t/spdylay/blob/master/lib/spdylay_session.c#L1528

In spdylay_session_send, send_callback always is passed flags set to 0, instead of the correct flags for the data or control frame.

Here is a quick patch:

int flags = (session->aob.item->frame_cat == SPDYLAY_CTRL) ?
spdylay_outbound_item_get_ctrl_frame(session->aob.item)->ctrl.hd.flags :
spdylay_outbound_item_get_data_frame(session->aob.item)->flags;
sentlen = session->callbacks.send_callback(session, data, datalen, flags,
session->user_data);

segfault in spdylay_gzip_inflate

Inside callback of on_data_chunk_recv_callback(),
retrieve request handler
req = spdylay_session_get_stream_user_data(session, stream_id);

My Request never sets gzip inflater; (double check by comment out spdylay_gzip_inflate_new();

However, after several msg exchanges, the req->inflater is not null and caused segfault inside spdylay_gzip_inflate;

Looks like some wired memory issues inside spdylay session.

(gdb) bt
#0 spdylay_gzip_inflate (inflater=0x534b6d3658377441, out=0x7ffff6ba7b80 "Basic eGn0ms0s8fyCVbQgZ_19F2w5tjAt7X6mKS7BXh3iIjMF4ycpFHdJpI3tQqQtkoBIvE_nDjDqMRdow-46i27omQ==",

outlen_ptr=0x7ffff6ba7b68, 
in=0x7ffff6ba8c88 "push ack success,\"data\":\"hello client: eGn0ms0s8fyCVbQgZ_19F2w5tjAt7X6mKS7BXh3iIjMF4ycpFHdJpI3tQqQtkoBIvE_nDjDqMRdow-46i27omQ== : mcBamw-jkLeDRnZS83GfF9Cy7aM= : u-server : u-worker : undefined\"}", inlen_ptr=0x7ffff6ba7b70) at spdylay_gzip.c:63

#1 0x0000000000403f1d in on_data_chunk_recv_callback (session=0x7ffff001ac20, flags=, stream_id=7,

data=0x7ffff6ba8c88 "push ack success,\"data\":\"hello client: eGn0ms0s8fyCVbQgZ_19F2w5tjAt7X6mKS7BXh3iIjMF4ycpFHdJpI3tQqQtkoBIvE_nDjDqMRdow-46i27omQ== : mcBamw-jkLeDRnZS83GfF9Cy7aM= : u-server : u-worker : undefined\"}", len=16, user_data=<optimized out>) at spdycli.c:734

#2 0x00007ffff75ae0ea in spdylay_session_mem_recv (session=0x7ffff001ac20, in=0x7ffff6ba8c80 "", inlen=) at spdylay_session.c:2631
#3 0x00007ffff75aeac9 in spdylay_session_recv (session=0x7ffff001ac20) at spdylay_session.c:2685
#4 0x00000000004039b4 in exec_io (connection=) at spdycli.c:1087
#5 initSpdySession (pthrduri=) at spdycli.c:1235
#6 0x000000000040463d in createSpdyClient (arg=0x620990) at spdycli.c:1132
#7 0x00007ffff738de9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#8 0x00007ffff70bb4bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#9 0x0000000000000000 in ?? ()

Add a spec for rpm packaging

Prefix: %{_usr}
Name: spdylay
Version: 0.3.3
Release: 1%{?dist}
Summary: The experimental SPDY protocol version 2 and 3 implementation in C

Group: System Environment/Libraries
License: MIT
URL: http://sourceforge.net/projects/spdylay/
Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: pkgconfig >= 0.20, zlib >= 1.2.3, gcc, gcc-c++, make, openssl-devel, Cython

BuildRequires:

Requires:

%description
This is an experimental implementation of Google's SPDY protocol in C.
This library provides SPDY version 2 and 3 framing layer implementation. It does not
perform any I/O operations. When the library needs them, it calls the callback functions
provided by the application. It also does not include any event polling mechanism,
so the application can freely choose the way of handling events. This library code does
not depend on any particular SSL library (except for example programs which depend on
OpenSSL 1.0.1 or later).

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q

%build
autoreconf -i
%{__automake}
%{__autoconf}
%configure --disable-static --enable-examples --disable-xmltest
%{__make} %{?_smp_mflags}

%{__make} html # needs python's 2.7 argparse

cython python/spdylay.pyx

%install
rm -rf $RPM_BUILD_ROOT
%{__make} install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc
%{libdir}/.so._
%exclude %{_libdir}/*.la

%files devel
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}
%{_includedir}/*
%{libdir}/.so
%{libdir}/pkgconfig/.pc

%changelog

shrpx with fast chunked backend and slow frontent connection

I've been toying with shrpx, and I think it's great, but I've run into an issue. I have backend server with a fast HTTP connection to shrpx, and it always sends chunked data. The connection on the frontend (which is SPDY) is much slower.

The client successfully connects to the server, starts downloading data, but it halts after a while (with stream reset). Here's what I see in verbose mode:

$ ./spdylay/src/spdycat -nv -3 --window-bits=16 -H 'Host: www.origo.hu' 'http://localhost:5555/index.html'
[  0.205] NPN select next protocol: the remote server offers:
          * spdy/3
          * spdy/2
          * http/1.1
          NPN selected the protocol: spdy/3
[  0.318] recv SETTINGS frame <version=3, flags=0, length=20>
          (niv=2)
          [4(0):100]
          [7(0):32]
[  0.318] send SETTINGS frame <version=3, flags=0, length=12>
          (niv=1)
          [7(0):65536]
[  0.318] send SYN_STREAM frame <version=3, flags=1, length=228>
          (stream_id=1, assoc_stream_id=0, pri=3)
          :host: www.origo.hu
          :method: GET
          :path: /index.html
          :scheme: http
          :version: HTTP/1.1
          accept: */*
          accept-encoding: gzip, deflate
          user-agent: spdylay/0.3.8-DEV
[  0.483] recv SYN_REPLY frame <version=3, flags=0, length=247>
          (stream_id=1)
          :status: 200 OK
          :version: HTTP/1.1
          content-type: text/html
          date: Wed, 27 Feb 2013 17:04:33 GMT
          pragma: no-cache
          server: Apache
          set-cookie: axelero=SLFDJLVENJJGGENGMPNLHFOTIHLLGRQTLELJGTIRPHKBDFADCIIFHMPNPAHMKJGQHIMTCCSHRBDFADCIIFHBDFADCIIFH;path=/;domain=.origo.hu;expires=Thu, 31-Dec-2015 23:59:59 GMT
          x-ua-compatible: IE=edge,chrome=1
[  0.485] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.485] recv DATA frame (stream_id=1, flags=0, length=1067)
[  0.507] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.583] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.613] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.613] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.613] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.648] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.648] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.690] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.690] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.690] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.718] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.718] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.718] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.754] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.754] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.754] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.790] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.790] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.790] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.837] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.837] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.837] send WINDOW_UPDATE frame <version=3, flags=0, length=8>
          (stream_id=1, delta_window_size=32923)
[  0.858] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.858] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.858] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.902] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.902] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.902] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.938] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.938] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.938] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.969] recv DATA frame (stream_id=1, flags=0, length=1448)
[  0.969] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.011] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.011] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.011] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.045] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.045] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.045] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.080] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.080] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.080] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.113] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.113] recv DATA frame (stream_id=1, flags=0, length=1448)
[  1.113] recv DATA frame (stream_id=1, flags=0, length=757)
[  1.113] recv RST_STREAM frame <version=3, flags=0, length=8>
          (stream_id=1, status_code=6)
[  1.114] send GOAWAY frame <version=3, flags=0, length=8>
          (last_good_stream_id=0)

The log on the server:

$ ./spdylay/src/shrpx --spdy-proxy --no-via --log-level=INFO -b 127.0.0.1,3333 -f 0.0.0.0,5555 --private-key-passwd-file=../keys/www.spdy.hu.key.password --spdy-max-concurrent-streams=100 ../keys/www.spdy.hu.key ../keys/www.spdy.hu.crt

[INFO] Resolving backend address
       (shrpx.cc:904)
[INFO] Address resolution for 127.0.0.1 succeeded: 127.0.0.1
       (shrpx.cc:105)
[INFO] Unable to get IPv6 address for 0.0.0.0: Address family for hostname not supported
       (shrpx.cc:148)
[INFO] Listening on 0.0.0.0, port 5555
       (shrpx.cc:186)
[INFO] Entering event loop
       (shrpx.cc:281)
[INFO] [LISTEN:0x2589320] Accepted connection. fd=7
       (shrpx_listen_handler.cc:97)
[INFO] [CLIENT_HANDLER:0x2587f40] SSL/TLS handleshake completed
       (shrpx_client_handler.cc:103)
[INFO] [CLIENT_HANDLER:0x2587f40] The negotiated next protocol: spdy/3
       (shrpx_client_handler.cc:205)
[INFO] [UPSTREAM:0x259fa20] Received upstream SYN_STREAM stream_id=1
       (shrpx_spdy_upstream.cc:147)
[INFO] [UPSTREAM:0x259fa20] HTTP request headers. stream_id=1
:host: www.origo.hu
:method: GET
:path: /index.html
:scheme: http
:version: HTTP/1.1
accept: */*
accept-encoding: gzip, deflate
user-agent: spdylay/0.3.8-DEV
       (shrpx_spdy_upstream.cc:201)
[INFO] [CLIENT_HANDLER:0x2587f40] Downstream connection pool is empty. Create new one
       (shrpx_client_handler.cc:272)
[INFO] [DCONN:0x259ec50] Attaching to DOWNSTREAM:0x25a0270
       (shrpx_http_downstream_connection.cc:70)
[INFO] [DCONN:0x259ec50] Connecting to downstream server
       (shrpx_http_downstream_connection.cc:89)
[INFO] [DCONN:0x259ec50] HTTP request headers. stream_id=1
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: spdylay/0.3.8-DEV
Host: www.origo.hu
X-Forwarded-Proto: http
       (shrpx_http_downstream_connection.cc:202)
[INFO] [DCONN:0x259ec50] Connection established. stream_id=1
       (shrpx_spdy_upstream.cc:514)
[INFO] [DOWNSTREAM:0x25a0270] HTTP response header completed
       (shrpx_spdy_upstream.cc:769)
[INFO] [UPSTREAM:0x259fa20] HTTP response headers. stream_id=1
:status: 200 OK
:version: HTTP/1.1
server: Apache
set-cookie: axelero=SLFDJLVENJJGGENGMPNLHFOTIHLLGRQTLELJGTIRPHKBDFADCIIFHMPNPAHMKJGQHIMTCCSHRBDFADCIIFHBDFADCIIFH;path=/;domain=.origo.hu;expires=Thu, 31-Dec-2015 23:59:59 GMT
content-type: text/html
pragma: no-cache
x-ua-compatible: IE=edge,chrome=1
date: Wed, 27 Feb 2013 17:06:29 GMT
       (shrpx_spdy_upstream.cc:810)
[INFO] [DOWNSTREAM:0x25a0270] HTTP response completed
       (shrpx_spdy_upstream.cc:860)
[INFO] [DCONN:0x259ec50] EOF. stream_id=1
       (shrpx_spdy_upstream.cc:526)
[INFO] [UPSTREAM:0x259fa20] RST_STREAM stream_id=1
       (shrpx_spdy_upstream.cc:625)
[INFO] [UPSTREAM:0x259fa20] Stream stream_id=1 is being closed
       (shrpx_spdy_upstream.cc:99)
[INFO] [DOWNSTREAM:0x25a0270] Deleting
       (shrpx_downstream.cc:67)
[INFO] [DOWNSTREAM:0x25a0270] Deleted
       (shrpx_downstream.cc:77)
[INFO] [UPSTREAM:0x259fa20] No more read/write for this SPDY session
       (shrpx_spdy_upstream.cc:393)
[INFO] [CLIENT_HANDLER:0x2587f40] Deleting
       (shrpx_client_handler.cc:147)
[INFO] [CLIENT_HANDLER:0x2587f40] Deleted
       (shrpx_client_handler.cc:165)

The successfully downloaded data is exactly 65536 bytes which is strange. I think it has to something with buffering... If I change window size on the client, the downloaded size changes, but never reaches the full file size, which is 89460 (even when it is set to 30).

When the backend link is slower, say I change the delay from 10ms to 50ms (it is simulated on localhost) then the problem goes away. When my backend server sends the whole content in one big chunk, the problem goes away again.

I do have a pcap trace as well, I uploaded it here: https://docs.google.com/file/d/0Bzj2UbMqUIfrRGdXZVZLRjFUdmc/edit?usp=sharing

Bring spdylay library in a custom program

Hi Tatsuhiro!
We would like to use you library in our program. We have a few problems while compiling the sources: all seems to work well but the "-a" option is disable beacause it says: "Warning: -a, --get-assets option cannot be used because
the binary was not compiled with libxml2."
Actually in our makefile we have included libxml2.. Do you have any suggestions?

Here's the makefile http://pastebin.com/1jhbPeFE

Examples fail to build

After a «make -k» to get everything which will build built, «make» reports:

Making all in examples
make[2]: Entering directory /home/cloos/src/spdylay-master/examples' g++-4.7.0 -DHAVE_CONFIG_H -I. -I.. -Wall -I./../lib/includes -I./../lib/includes -I/usr/kerberos/include -std=c++0x -O3 -ggdb3 -march=amdfam10 -floop-interchange -floop-strip-mine -floop-block -flto -fwhole-program -MT spdynative-spdylay_ssl.o -MD -MP -MF .deps/spdynative-spdylay_ssl.Tpo -c -o spdynative-spdylay_ssl.otest -f 'spdylay_ssl.cc' || echo './'`spdylay_ssl.cc
spdylay_ssl.cc: In member function ‘int spdylay::Spdylay::submit_request(const string&, const string&, uint8_t, void_)’:
spdylay_ssl.cc:120:19: error: unable to find string literal operator ‘operator"" SPDYLAY_VERSION’
make[2]: *_* [spdynative-spdylay_ssl.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.