comparison src/http/ngx_http_spdy.c @ 5664:de93bbe2d8cd

SPDY: Stream-ID restrictions according to specification.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 21 Apr 2014 18:59:53 +0400
parents b6240baead00
children 46d0795a846c
comparison
equal deleted inserted replaced
5663:001beb963d86 5664:de93bbe2d8cd
935 pos += NGX_SPDY_SYN_STREAM_SIZE; 935 pos += NGX_SPDY_SYN_STREAM_SIZE;
936 936
937 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 937 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
938 "spdy SYN_STREAM frame sid:%ui prio:%ui", sid, prio); 938 "spdy SYN_STREAM frame sid:%ui prio:%ui", sid, prio);
939 939
940 if (sid % 2 == 0 || sid <= sc->last_sid) {
941 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
942 "client sent SYN_STREAM frame "
943 "with invalid Stream-ID %ui", sid);
944
945 stream = ngx_http_spdy_get_stream_by_id(sc, sid);
946
947 if (stream) {
948 if (ngx_http_spdy_terminate_stream(sc, stream,
949 NGX_SPDY_PROTOCOL_ERROR)
950 != NGX_OK)
951 {
952 return ngx_http_spdy_state_internal_error(sc);
953 }
954 }
955
956 return ngx_http_spdy_state_protocol_error(sc);
957 }
958
959 sc->last_sid = sid;
960
940 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx, 961 sscf = ngx_http_get_module_srv_conf(sc->http_connection->conf_ctx,
941 ngx_http_spdy_module); 962 ngx_http_spdy_module);
942 963
943 if (sc->processing >= sscf->concurrent_streams) { 964 if (sc->processing >= sscf->concurrent_streams) {
944 965
965 stream->request->request_length = NGX_SPDY_FRAME_HEADER_SIZE 986 stream->request->request_length = NGX_SPDY_FRAME_HEADER_SIZE
966 + NGX_SPDY_SYN_STREAM_SIZE 987 + NGX_SPDY_SYN_STREAM_SIZE
967 + sc->length; 988 + sc->length;
968 989
969 sc->stream = stream; 990 sc->stream = stream;
970
971 sc->last_sid = sid;
972 991
973 return ngx_http_spdy_state_headers(sc, pos, end); 992 return ngx_http_spdy_state_headers(sc, pos, end);
974 } 993 }
975 994
976 995