Skip to content

Instantly share code, notes, and snippets.

@mtourne
Created November 19, 2012 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtourne/4113700 to your computer and use it in GitHub Desktop.
Save mtourne/4113700 to your computer and use it in GitHub Desktop.
Unified diff of spdy.52 and spdy.53 patches Delta.
diff --git a/src/http/ngx_http_spdy.c b/src/http/ngx_http_spdy.c
index 85b2620..7c55ca7 100644
--- a/src/http/ngx_http_spdy.c
+++ b/src/http/ngx_http_spdy.c
@@ -268,6 +268,8 @@ ngx_http_init_spdy(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
"init spdy request");
+ c->log->action = "spdy connection";
+
sc = ngx_pcalloc(c->pool, sizeof(ngx_http_spdy_connection_t));
if (sc == NULL) {
ngx_http_spdy_close_connection(c);
@@ -1018,9 +1020,15 @@ ngx_http_spdy_process_frame(ngx_http_spdy_connection_t *sc, u_char **pos,
#if (NGX_HAVE_NONALIGNED)
head = *(uint32_t *) p;
#else
+
+#if (NGX_HAVE_LITTLE_ENDIAN)
+ head = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+#else
head = p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
#endif
+#endif
+
flags = p[4];
length = ngx_spdy_frame_parse_len(p + 5);
@@ -3049,6 +3057,8 @@ ngx_http_spdy_terminate_request(ngx_http_request_t *r, ngx_int_t rc)
return;
}
+ r->count = 1; //FIXME
+
ngx_http_spdy_close_request(r, rc);
}
@@ -3165,7 +3175,7 @@ ngx_http_spdy_handle_connection(ngx_http_spdy_connection_t *sc)
c = sc->connection;
- if (c->buffered) {
+ if (c->buffered || sc->out_frames) {
return;
}
diff --git a/src/http/ngx_http_spdy_filter_module.c b/src/http/ngx_http_spdy_filter_module.c
index 275de51..7172caa 100644
--- a/src/http/ngx_http_spdy_filter_module.c
+++ b/src/http/ngx_http_spdy_filter_module.c
@@ -477,16 +477,17 @@ ngx_http_spdy_header_filter(ngx_http_request_t *r)
(void) ngx_spdy_frame_write_uint16(hb->pos, count);
- /* TODO: better zlib overhead computation */
- b = ngx_create_temp_buf(r->pool, hb->last - hb->pos + 14 + 15);
+ sc = r->spdy_stream->connection;
+
+ len = hb->last - hb->pos;
+
+ b = ngx_create_temp_buf(r->pool, 14 + deflateBound(&sc->zstream_out, len));
if (b == NULL) {
return NGX_ERROR;
}
b->last += 14;
- sc = r->spdy_stream->connection;
-
sc->zstream_out.next_in = hb->pos;
sc->zstream_out.avail_in = hb->last - hb->pos;
sc->zstream_out.next_out = b->last;
diff --git a/src/http/ngx_http_spdy_module.c b/src/http/ngx_http_spdy_module.c
index 705d4bc..82adb54 100644
--- a/src/http/ngx_http_spdy_module.c
+++ b/src/http/ngx_http_spdy_module.c
@@ -285,7 +285,8 @@ ngx_http_spdy_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_msec_value(conf->keepalive_timeout,
prev->keepalive_timeout, 180000);
- ngx_conf_merge_value(conf->headers_comp, prev->headers_comp, Z_BEST_SPEED);
+ ngx_conf_merge_value(conf->headers_comp, prev->headers_comp,
+ Z_NO_COMPRESSION);
ngx_conf_merge_size_value(conf->headers_comp_wbits,
prev->headers_comp_wbits,
ngx_min(11, MAX_WBITS));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment