comparison src/http/ngx_http_spdy.c @ 5693:701d6e17e42c

SPDY: improved logging.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 30 Apr 2014 20:34:20 +0400
parents ed5fb7d22d46
children 9a95eb9f448b
comparison
equal deleted inserted replaced
5692:ed5fb7d22d46 5693:701d6e17e42c
393 ngx_http_spdy_connection_t *sc; 393 ngx_http_spdy_connection_t *sc;
394 394
395 c = rev->data; 395 c = rev->data;
396 hc = c->data; 396 hc = c->data;
397 397
398 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, 398 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "init spdy request");
399 "init spdy request");
400 399
401 c->log->action = "processing SPDY"; 400 c->log->action = "processing SPDY";
402 401
403 smcf = ngx_http_get_module_main_conf(hc->conf_ctx, ngx_http_spdy_module); 402 smcf = ngx_http_get_module_main_conf(hc->conf_ctx, ngx_http_spdy_module);
404 403
554 break; 553 break;
555 } 554 }
556 555
557 if (n == 0 && (sc->incomplete || sc->processing)) { 556 if (n == 0 && (sc->incomplete || sc->processing)) {
558 ngx_log_error(NGX_LOG_INFO, c->log, 0, 557 ngx_log_error(NGX_LOG_INFO, c->log, 0,
559 "client closed prematurely connection"); 558 "client prematurely closed connection");
560 } 559 }
561 560
562 if (n == 0 || n == NGX_ERROR) { 561 if (n == 0 || n == NGX_ERROR) {
563 ngx_http_spdy_finalize_connection(sc, 562 ngx_http_spdy_finalize_connection(sc,
564 NGX_HTTP_CLIENT_CLOSED_REQUEST); 563 NGX_HTTP_CLIENT_CLOSED_REQUEST);
642 stream = ngx_queue_data(q, ngx_http_spdy_stream_t, queue); 641 stream = ngx_queue_data(q, ngx_http_spdy_stream_t, queue);
643 642
644 stream->handled = 0; 643 stream->handled = 0;
645 644
646 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 645 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
647 "spdy run stream %ui", stream->id); 646 "run spdy stream %ui", stream->id);
648 647
649 wev = stream->request->connection->write; 648 wev = stream->request->connection->write;
650 wev->handler(wev); 649 wev->handler(wev);
651 } 650 }
652 651
858 sc->length = ngx_spdy_frame_length(flen); 857 sc->length = ngx_spdy_frame_length(flen);
859 858
860 pos += sizeof(uint32_t); 859 pos += sizeof(uint32_t);
861 860
862 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 861 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
863 "spdy process frame head:%08XD f:%Xd l:%uz", 862 "process spdy frame head:%08XD f:%Xd l:%uz",
864 head, sc->flags, sc->length); 863 head, sc->flags, sc->length);
865 864
866 if (ngx_spdy_ctl_frame_check(head)) { 865 if (ngx_spdy_ctl_frame_check(head)) {
867 type = ngx_spdy_ctl_frame_type(head); 866 type = ngx_spdy_ctl_frame_type(head);
868 867
870 869
871 case NGX_SPDY_SYN_STREAM: 870 case NGX_SPDY_SYN_STREAM:
872 return ngx_http_spdy_state_syn_stream(sc, pos, end); 871 return ngx_http_spdy_state_syn_stream(sc, pos, end);
873 872
874 case NGX_SPDY_SYN_REPLY: 873 case NGX_SPDY_SYN_REPLY:
874 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
875 "client sent unexpected SYN_REPLY frame");
875 return ngx_http_spdy_state_protocol_error(sc); 876 return ngx_http_spdy_state_protocol_error(sc);
876 877
877 case NGX_SPDY_RST_STREAM: 878 case NGX_SPDY_RST_STREAM:
878 return ngx_http_spdy_state_rst_stream(sc, pos, end); 879 return ngx_http_spdy_state_rst_stream(sc, pos, end);
879 880
885 886
886 case NGX_SPDY_GOAWAY: 887 case NGX_SPDY_GOAWAY:
887 return ngx_http_spdy_state_skip(sc, pos, end); /* TODO */ 888 return ngx_http_spdy_state_skip(sc, pos, end); /* TODO */
888 889
889 case NGX_SPDY_HEADERS: 890 case NGX_SPDY_HEADERS:
891 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
892 "client sent unexpected HEADERS frame");
890 return ngx_http_spdy_state_protocol_error(sc); 893 return ngx_http_spdy_state_protocol_error(sc);
891 894
892 case NGX_SPDY_WINDOW_UPDATE: 895 case NGX_SPDY_WINDOW_UPDATE:
893 return ngx_http_spdy_state_window_update(sc, pos, end); 896 return ngx_http_spdy_state_window_update(sc, pos, end);
894 897
902 if (ngx_spdy_data_frame_check(head)) { 905 if (ngx_spdy_data_frame_check(head)) {
903 sc->stream = ngx_http_spdy_get_stream_by_id(sc, head); 906 sc->stream = ngx_http_spdy_get_stream_by_id(sc, head);
904 return ngx_http_spdy_state_data(sc, pos, end); 907 return ngx_http_spdy_state_data(sc, pos, end);
905 } 908 }
906 909
907 910 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
908 /* TODO version & type check */ 911 "client sent invalid frame");
909 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
910 "spdy unknown frame");
911 912
912 return ngx_http_spdy_state_protocol_error(sc); 913 return ngx_http_spdy_state_protocol_error(sc);
913 } 914 }
914 915
915 916
925 return ngx_http_spdy_state_save(sc, pos, end, 926 return ngx_http_spdy_state_save(sc, pos, end,
926 ngx_http_spdy_state_syn_stream); 927 ngx_http_spdy_state_syn_stream);
927 } 928 }
928 929
929 if (sc->length <= NGX_SPDY_SYN_STREAM_SIZE) { 930 if (sc->length <= NGX_SPDY_SYN_STREAM_SIZE) {
930 /* TODO logging */ 931 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
932 "client sent SYN_STREAM frame with incorrect length %uz",
933 sc->length);
934
931 return ngx_http_spdy_state_protocol_error(sc); 935 return ngx_http_spdy_state_protocol_error(sc);
932 } 936 }
933 937
934 sc->length -= NGX_SPDY_SYN_STREAM_SIZE; 938 sc->length -= NGX_SPDY_SYN_STREAM_SIZE;
935 939
966 ngx_http_spdy_module); 970 ngx_http_spdy_module);
967 971
968 if (sc->processing >= sscf->concurrent_streams) { 972 if (sc->processing >= sscf->concurrent_streams) {
969 973
970 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 974 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
971 "spdy concurrent streams exceeded %ui", sc->processing); 975 "concurrent streams exceeded %ui", sc->processing);
972 976
973 if (ngx_http_spdy_send_rst_stream(sc, sid, NGX_SPDY_REFUSED_STREAM, 977 if (ngx_http_spdy_send_rst_stream(sc, sid, NGX_SPDY_REFUSED_STREAM,
974 prio) 978 prio)
975 != NGX_OK) 979 != NGX_OK)
976 { 980 {
1024 } 1028 }
1025 1029
1026 r = sc->stream->request; 1030 r = sc->stream->request;
1027 1031
1028 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1032 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1029 "spdy process HEADERS %uz of %uz", size, sc->length); 1033 "process spdy header block %uz of %uz", size, sc->length);
1030 1034
1031 buf = r->header_in; 1035 buf = r->header_in;
1032 1036
1033 sc->zstream_in.next_in = pos; 1037 sc->zstream_in.next_in = pos;
1034 sc->zstream_in.avail_in = size; 1038 sc->zstream_in.avail_in = size;
1099 sc->entries = ngx_spdy_frame_parse_uint32(buf->pos); 1103 sc->entries = ngx_spdy_frame_parse_uint32(buf->pos);
1100 1104
1101 buf->pos += NGX_SPDY_NV_NUM_SIZE; 1105 buf->pos += NGX_SPDY_NV_NUM_SIZE;
1102 1106
1103 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1107 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1104 "spdy HEADERS block consists of %ui entries", 1108 "spdy header block has %ui entries",
1105 sc->entries); 1109 sc->entries);
1106 1110
1107 if (ngx_list_init(&r->headers_in.headers, r->pool, 20, 1111 if (ngx_list_init(&r->headers_in.headers, r->pool, 20,
1108 sizeof(ngx_table_elt_t)) 1112 sizeof(ngx_table_elt_t))
1109 != NGX_OK) 1113 != NGX_OK)
1140 if (sc->zstream_in.avail_in) { 1144 if (sc->zstream_in.avail_in) {
1141 1145
1142 rc = ngx_http_spdy_alloc_large_header_buffer(r); 1146 rc = ngx_http_spdy_alloc_large_header_buffer(r);
1143 1147
1144 if (rc == NGX_DECLINED) { 1148 if (rc == NGX_DECLINED) {
1145 /* TODO logging */
1146 ngx_http_finalize_request(r, 1149 ngx_http_finalize_request(r,
1147 NGX_HTTP_REQUEST_HEADER_TOO_LARGE); 1150 NGX_HTTP_REQUEST_HEADER_TOO_LARGE);
1148 return ngx_http_spdy_state_headers_skip(sc, pos, end); 1151 return ngx_http_spdy_state_headers_skip(sc, pos, end);
1149 } 1152 }
1150 1153
1177 1180
1178 continue; 1181 continue;
1179 } 1182 }
1180 1183
1181 if (complete) { 1184 if (complete) {
1182 /* TODO: improve error message */
1183 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 1185 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1184 "spdy again while last chunk"); 1186 "premature end of spdy header block");
1185 1187
1186 return ngx_http_spdy_state_headers_error(sc, pos, end); 1188 return ngx_http_spdy_state_headers_error(sc, pos, end);
1187 } 1189 }
1188 1190
1189 return ngx_http_spdy_state_save(sc, pos, end, 1191 return ngx_http_spdy_state_save(sc, pos, end,
1190 ngx_http_spdy_state_headers); 1192 ngx_http_spdy_state_headers);
1191 1193
1192 case NGX_HTTP_PARSE_INVALID_HEADER: 1194 case NGX_HTTP_PARSE_INVALID_HEADER:
1193
1194 /* TODO: improve error message */
1195 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1196 "client sent invalid header line");
1197
1198 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 1195 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1199
1200 return ngx_http_spdy_state_headers_skip(sc, pos, end); 1196 return ngx_http_spdy_state_headers_skip(sc, pos, end);
1201 1197
1202 default: /* NGX_ERROR */ 1198 default: /* NGX_ERROR */
1203 return ngx_http_spdy_state_headers_error(sc, pos, end); 1199 return ngx_http_spdy_state_headers_error(sc, pos, end);
1204 } 1200 }
1260 if (size == 0) { 1256 if (size == 0) {
1261 return ngx_http_spdy_state_save(sc, pos, end, 1257 return ngx_http_spdy_state_save(sc, pos, end,
1262 ngx_http_spdy_state_headers_skip); 1258 ngx_http_spdy_state_headers_skip);
1263 } 1259 }
1264 1260
1261 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1262 "spdy header block skip %uz of %uz", size, sc->length);
1263
1265 sc->zstream_in.next_in = pos; 1264 sc->zstream_in.next_in = pos;
1266 sc->zstream_in.avail_in = (size < sc->length) ? size : sc->length; 1265 sc->zstream_in.avail_in = (size < sc->length) ? size : sc->length;
1267 1266
1268 while (sc->zstream_in.avail_in) { 1267 while (sc->zstream_in.avail_in) {
1269 sc->zstream_in.next_out = buffer; 1268 sc->zstream_in.next_out = buffer;
1362 if (stream->send_window > (ssize_t) (NGX_SPDY_MAX_WINDOW - delta)) { 1361 if (stream->send_window > (ssize_t) (NGX_SPDY_MAX_WINDOW - delta)) {
1363 1362
1364 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 1363 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1365 "client violated flow control for stream %ui: " 1364 "client violated flow control for stream %ui: "
1366 "received WINDOW_UPDATE frame with delta %uz " 1365 "received WINDOW_UPDATE frame with delta %uz "
1367 "that is not allowed for window %z", 1366 "not allowed for window %z",
1368 sid, delta, stream->send_window); 1367 sid, delta, stream->send_window);
1369 1368
1370 if (ngx_http_spdy_terminate_stream(sc, stream, 1369 if (ngx_http_spdy_terminate_stream(sc, stream,
1371 NGX_SPDY_FLOW_CONTROL_ERROR) 1370 NGX_SPDY_FLOW_CONTROL_ERROR)
1372 == NGX_ERROR) 1371 == NGX_ERROR)
1395 1394
1396 if (sc->send_window > NGX_SPDY_MAX_WINDOW) { 1395 if (sc->send_window > NGX_SPDY_MAX_WINDOW) {
1397 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 1396 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1398 "client violated connection flow control: " 1397 "client violated connection flow control: "
1399 "received WINDOW_UPDATE frame with delta %uz " 1398 "received WINDOW_UPDATE frame with delta %uz "
1400 "that is not allowed for window %uz", 1399 "not allowed for window %uz",
1401 delta, sc->send_window); 1400 delta, sc->send_window);
1402 1401
1403 return ngx_http_spdy_state_protocol_error(sc); 1402 return ngx_http_spdy_state_protocol_error(sc);
1404 } 1403 }
1405 1404
1438 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 1437 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1439 "spdy DATA frame"); 1438 "spdy DATA frame");
1440 1439
1441 if (sc->length > sc->recv_window) { 1440 if (sc->length > sc->recv_window) {
1442 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 1441 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1443 "client violated connection flow control: length of " 1442 "client violated connection flow control: "
1444 "received DATA frame %uz, while available window %uz", 1443 "received DATA frame length %uz, available window %uz",
1445 sc->length, sc->recv_window); 1444 sc->length, sc->recv_window);
1446 1445
1447 return ngx_http_spdy_state_protocol_error(sc); 1446 return ngx_http_spdy_state_protocol_error(sc);
1448 } 1447 }
1449 1448
1463 } 1462 }
1464 1463
1465 stream = sc->stream; 1464 stream = sc->stream;
1466 1465
1467 if (stream == NULL) { 1466 if (stream == NULL) {
1467 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1468 "unknown spdy stream");
1469
1468 return ngx_http_spdy_state_skip(sc, pos, end); 1470 return ngx_http_spdy_state_skip(sc, pos, end);
1469 } 1471 }
1470 1472
1471 if (sc->length > stream->recv_window) { 1473 if (sc->length > stream->recv_window) {
1472 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 1474 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1473 "client violated flow control for stream %ui: length of " 1475 "client violated flow control for stream %ui: "
1474 "received DATA frame %uz, while available window %uz", 1476 "received DATA frame length %uz, available window %uz",
1475 stream->id, sc->length, stream->recv_window); 1477 stream->id, sc->length, stream->recv_window);
1476 1478
1477 if (ngx_http_spdy_terminate_stream(sc, stream, 1479 if (ngx_http_spdy_terminate_stream(sc, stream,
1478 NGX_SPDY_FLOW_CONTROL_ERROR) 1480 NGX_SPDY_FLOW_CONTROL_ERROR)
1479 == NGX_ERROR) 1481 == NGX_ERROR)
1499 stream->recv_window = NGX_SPDY_STREAM_WINDOW; 1501 stream->recv_window = NGX_SPDY_STREAM_WINDOW;
1500 } 1502 }
1501 1503
1502 if (stream->in_closed) { 1504 if (stream->in_closed) {
1503 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0, 1505 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1504 "client sent DATA frame for half closed stream %ui", 1506 "client sent DATA frame for half-closed stream %ui",
1505 stream->id); 1507 stream->id);
1506 1508
1507 if (ngx_http_spdy_terminate_stream(sc, stream, 1509 if (ngx_http_spdy_terminate_stream(sc, stream,
1508 NGX_SPDY_STREAM_ALREADY_CLOSED) 1510 NGX_SPDY_STREAM_ALREADY_CLOSED)
1509 == NGX_ERROR) 1511 == NGX_ERROR)
1542 1544
1543 if (sc->flags & NGX_SPDY_FLAG_FIN) { 1545 if (sc->flags & NGX_SPDY_FLAG_FIN) {
1544 stream->in_closed = 1; 1546 stream->in_closed = 1;
1545 } 1547 }
1546 1548
1547 /* TODO log and accounting */ 1549 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1550 "skipping spdy DATA frame, reason: %d",
1551 stream->skip_data);
1552
1548 return ngx_http_spdy_state_skip(sc, pos, end); 1553 return ngx_http_spdy_state_skip(sc, pos, end);
1549 } 1554 }
1550 1555
1551 size = end - pos; 1556 size = end - pos;
1552 1557
1571 rb->rest += size; 1576 rb->rest += size;
1572 1577
1573 if (r->headers_in.content_length_n != -1 1578 if (r->headers_in.content_length_n != -1
1574 && r->headers_in.content_length_n < rb->rest) 1579 && r->headers_in.content_length_n < rb->rest)
1575 { 1580 {
1576 /* TODO logging */ 1581 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1582 "client intended to send body data "
1583 "larger than declared");
1584
1577 stream->skip_data = NGX_SPDY_DATA_ERROR; 1585 stream->skip_data = NGX_SPDY_DATA_ERROR;
1578 goto error; 1586 goto error;
1579 1587
1580 } else { 1588 } else {
1581 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1589 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1582 1590
1583 if (clcf->client_max_body_size 1591 if (clcf->client_max_body_size
1584 && clcf->client_max_body_size < rb->rest) 1592 && clcf->client_max_body_size < rb->rest)
1585 { 1593 {
1586 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 1594 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1587 "client intended to send too large chunked " 1595 "client intended to send "
1588 "body: %O bytes", 1596 "too large chunked body: %O bytes", rb->rest);
1589 rb->rest);
1590 1597
1591 stream->skip_data = NGX_SPDY_DATA_ERROR; 1598 stream->skip_data = NGX_SPDY_DATA_ERROR;
1592 goto error; 1599 goto error;
1593 } 1600 }
1594 } 1601 }
1636 r->headers_in.content_length_n = rb->rest; 1643 r->headers_in.content_length_n = rb->rest;
1637 1644
1638 } else if (r->headers_in.content_length_n != rb->rest) { 1645 } else if (r->headers_in.content_length_n != rb->rest) {
1639 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1646 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1640 "client prematurely closed stream: " 1647 "client prematurely closed stream: "
1641 "%O of %O bytes of request body received", 1648 "only %O out of %O bytes of request body received",
1642 rb->rest, r->headers_in.content_length_n); 1649 rb->rest, r->headers_in.content_length_n);
1643 1650
1644 stream->skip_data = NGX_SPDY_DATA_ERROR; 1651 stream->skip_data = NGX_SPDY_DATA_ERROR;
1645 goto error; 1652 goto error;
1646 } 1653 }
1715 1722
1716 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 1723 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1717 "spdy RST_STREAM sid:%ui st:%ui", sid, status); 1724 "spdy RST_STREAM sid:%ui st:%ui", sid, status);
1718 1725
1719 stream = ngx_http_spdy_get_stream_by_id(sc, sid); 1726 stream = ngx_http_spdy_get_stream_by_id(sc, sid);
1727
1720 if (stream == NULL) { 1728 if (stream == NULL) {
1721 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 1729 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1722 "unknown stream, probably it has been closed already"); 1730 "unknown spdy stream");
1731
1723 return ngx_http_spdy_state_complete(sc, pos, end); 1732 return ngx_http_spdy_state_complete(sc, pos, end);
1724 } 1733 }
1725 1734
1726 stream->in_closed = 1; 1735 stream->in_closed = 1;
1727 stream->out_closed = 1; 1736 stream->out_closed = 1;
1736 "client canceled stream %ui", sid); 1745 "client canceled stream %ui", sid);
1737 break; 1746 break;
1738 1747
1739 case NGX_SPDY_INTERNAL_ERROR: 1748 case NGX_SPDY_INTERNAL_ERROR:
1740 ngx_log_error(NGX_LOG_INFO, fc->log, 0, 1749 ngx_log_error(NGX_LOG_INFO, fc->log, 0,
1741 "client terminated stream %ui because of internal error", 1750 "client terminated stream %ui due to internal error",
1742 sid); 1751 sid);
1743 break; 1752 break;
1744 1753
1745 default: 1754 default:
1746 ngx_log_error(NGX_LOG_INFO, fc->log, 0, 1755 ngx_log_error(NGX_LOG_INFO, fc->log, 0,
1768 return ngx_http_spdy_state_save(sc, pos, end, 1777 return ngx_http_spdy_state_save(sc, pos, end,
1769 ngx_http_spdy_state_ping); 1778 ngx_http_spdy_state_ping);
1770 } 1779 }
1771 1780
1772 if (sc->length != NGX_SPDY_PING_SIZE) { 1781 if (sc->length != NGX_SPDY_PING_SIZE) {
1773 /* TODO logging */ 1782 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1783 "client sent PING frame with incorrect length %uz",
1784 sc->length);
1785
1774 return ngx_http_spdy_state_protocol_error(sc); 1786 return ngx_http_spdy_state_protocol_error(sc);
1775 } 1787 }
1776 1788
1777 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 1789 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1778 "spdy PING frame"); 1790 "spdy PING frame");
1808 { 1820 {
1809 size_t size; 1821 size_t size;
1810 1822
1811 size = end - pos; 1823 size = end - pos;
1812 1824
1825 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1826 "spdy frame skip %uz of %uz", size, sc->length);
1827
1813 if (size < sc->length) { 1828 if (size < sc->length) {
1814 sc->length -= size; 1829 sc->length -= size;
1815 return ngx_http_spdy_state_save(sc, end, end, 1830 return ngx_http_spdy_state_save(sc, end, end,
1816 ngx_http_spdy_state_skip); 1831 ngx_http_spdy_state_skip);
1817 } 1832 }
1837 1852
1838 pos += NGX_SPDY_SETTINGS_NUM_SIZE; 1853 pos += NGX_SPDY_SETTINGS_NUM_SIZE;
1839 sc->length -= NGX_SPDY_SETTINGS_NUM_SIZE; 1854 sc->length -= NGX_SPDY_SETTINGS_NUM_SIZE;
1840 1855
1841 if (sc->length < sc->entries * NGX_SPDY_SETTINGS_PAIR_SIZE) { 1856 if (sc->length < sc->entries * NGX_SPDY_SETTINGS_PAIR_SIZE) {
1842 /* TODO logging */ 1857 ngx_log_error(NGX_LOG_INFO, sc->connection->log, 0,
1858 "client sent SETTINGS frame with incorrect "
1859 "length %uz or number of entries %ui",
1860 sc->length, sc->entries);
1861
1843 return ngx_http_spdy_state_protocol_error(sc); 1862 return ngx_http_spdy_state_protocol_error(sc);
1844 } 1863 }
1845 1864
1846 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 1865 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1847 "spdy SETTINGS frame consists of %ui entries", 1866 "spdy SETTINGS frame has %ui entries", sc->entries);
1848 sc->entries);
1849 } 1867 }
1850 1868
1851 while (sc->entries) { 1869 while (sc->entries) {
1852 if (end - pos < NGX_SPDY_SETTINGS_PAIR_SIZE) { 1870 if (end - pos < NGX_SPDY_SETTINGS_PAIR_SIZE) {
1853 return ngx_http_spdy_state_save(sc, pos, end, 1871 return ngx_http_spdy_state_save(sc, pos, end,
1903 1921
1904 static u_char * 1922 static u_char *
1905 ngx_http_spdy_state_complete(ngx_http_spdy_connection_t *sc, u_char *pos, 1923 ngx_http_spdy_state_complete(ngx_http_spdy_connection_t *sc, u_char *pos,
1906 u_char *end) 1924 u_char *end)
1907 { 1925 {
1926 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1927 "spdy frame complete pos:%p end:%p", pos, end);
1928
1908 sc->handler = ngx_http_spdy_state_head; 1929 sc->handler = ngx_http_spdy_state_head;
1909 sc->stream = NULL; 1930 sc->stream = NULL;
1910 1931
1911 return pos; 1932 return pos;
1912 } 1933 }
1916 ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc, 1937 ngx_http_spdy_state_save(ngx_http_spdy_connection_t *sc,
1917 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler) 1938 u_char *pos, u_char *end, ngx_http_spdy_handler_pt handler)
1918 { 1939 {
1919 size_t size; 1940 size_t size;
1920 1941
1942 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
1943 "spdy frame state save pos:%p end:%p handler:%p",
1944 pos, end, handler);
1945
1921 size = end - pos; 1946 size = end - pos;
1922 1947
1923 if (size > NGX_SPDY_STATE_BUFFER_SIZE) { 1948 if (size > NGX_SPDY_STATE_BUFFER_SIZE) {
1924 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, 1949 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0,
1925 "spdy state buffer overflow: " 1950 "state buffer overflow: %uz bytes required", size);
1926 "%uz bytes required", size); 1951
1927 return ngx_http_spdy_state_internal_error(sc); 1952 return ngx_http_spdy_state_internal_error(sc);
1928 } 1953 }
1929 1954
1930 ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE); 1955 ngx_memcpy(sc->buffer, pos, NGX_SPDY_STATE_BUFFER_SIZE);
1931 1956
1996 u_char *p; 2021 u_char *p;
1997 ngx_buf_t *buf; 2022 ngx_buf_t *buf;
1998 ngx_http_spdy_out_frame_t *frame; 2023 ngx_http_spdy_out_frame_t *frame;
1999 2024
2000 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 2025 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
2001 "spdy write WINDOW_UPDATE sid:%ui delta:%ui", sid, delta); 2026 "spdy send WINDOW_UPDATE sid:%ui delta:%ui", sid, delta);
2002 2027
2003 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_WINDOW_UPDATE_SIZE, 2028 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_WINDOW_UPDATE_SIZE,
2004 NGX_SPDY_HIGHEST_PRIORITY); 2029 NGX_SPDY_HIGHEST_PRIORITY);
2005 if (frame == NULL) { 2030 if (frame == NULL) {
2006 return NGX_ERROR; 2031 return NGX_ERROR;
2035 if (sc->connection->error) { 2060 if (sc->connection->error) {
2036 return NGX_OK; 2061 return NGX_OK;
2037 } 2062 }
2038 2063
2039 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 2064 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
2040 "spdy write RST_STREAM sid:%ui st:%ui", sid, status); 2065 "spdy send RST_STREAM sid:%ui st:%ui", sid, status);
2041 2066
2042 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_RST_STREAM_SIZE, 2067 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_RST_STREAM_SIZE,
2043 priority); 2068 priority);
2044 if (frame == NULL) { 2069 if (frame == NULL) {
2045 return NGX_ERROR; 2070 return NGX_ERROR;
2070 u_char *p; 2095 u_char *p;
2071 ngx_buf_t *buf; 2096 ngx_buf_t *buf;
2072 ngx_http_spdy_out_frame_t *frame; 2097 ngx_http_spdy_out_frame_t *frame;
2073 2098
2074 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 2099 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
2075 "spdy create GOAWAY sid:%ui", sc->last_sid); 2100 "spdy send GOAWAY sid:%ui", sc->last_sid);
2076 2101
2077 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_GOAWAY_SIZE, 2102 frame = ngx_http_spdy_get_ctl_frame(sc, NGX_SPDY_GOAWAY_SIZE,
2078 NGX_SPDY_HIGHEST_PRIORITY); 2103 NGX_SPDY_HIGHEST_PRIORITY);
2079 if (frame == NULL) { 2104 if (frame == NULL) {
2080 return NGX_ERROR; 2105 return NGX_ERROR;
2106 ngx_chain_t *cl; 2131 ngx_chain_t *cl;
2107 ngx_http_spdy_srv_conf_t *sscf; 2132 ngx_http_spdy_srv_conf_t *sscf;
2108 ngx_http_spdy_out_frame_t *frame; 2133 ngx_http_spdy_out_frame_t *frame;
2109 2134
2110 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0, 2135 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, sc->connection->log, 0,
2111 "spdy create SETTINGS frame"); 2136 "spdy send SETTINGS frame");
2112 2137
2113 frame = ngx_palloc(sc->pool, sizeof(ngx_http_spdy_out_frame_t)); 2138 frame = ngx_palloc(sc->pool, sizeof(ngx_http_spdy_out_frame_t));
2114 if (frame == NULL) { 2139 if (frame == NULL) {
2115 return NGX_ERROR; 2140 return NGX_ERROR;
2116 } 2141 }
2228 } 2253 }
2229 2254
2230 #if (NGX_DEBUG) 2255 #if (NGX_DEBUG)
2231 if (length > NGX_SPDY_CTL_FRAME_BUFFER_SIZE - NGX_SPDY_FRAME_HEADER_SIZE) { 2256 if (length > NGX_SPDY_CTL_FRAME_BUFFER_SIZE - NGX_SPDY_FRAME_HEADER_SIZE) {
2232 ngx_log_error(NGX_LOG_ALERT, sc->pool->log, 0, 2257 ngx_log_error(NGX_LOG_ALERT, sc->pool->log, 0,
2233 "requested control frame is too big: %uz", length); 2258 "requested control frame is too large: %uz", length);
2234 return NULL; 2259 return NULL;
2235 } 2260 }
2236 2261
2237 frame->length = length; 2262 frame->length = length;
2238 #endif 2263 #endif
2496 switch (ch) { 2521 switch (ch) {
2497 case '\0': 2522 case '\0':
2498 case LF: 2523 case LF:
2499 case CR: 2524 case CR:
2500 case ':': 2525 case ':':
2526 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2527 "client sent invalid header name: \"%*s\"",
2528 r->lowcase_index, r->header_name_start);
2529
2501 return NGX_HTTP_PARSE_INVALID_HEADER; 2530 return NGX_HTTP_PARSE_INVALID_HEADER;
2502 } 2531 }
2503 2532
2504 if (ch >= 'A' && ch <= 'Z') { 2533 if (ch >= 'A' && ch <= 'Z') {
2505 return NGX_ERROR; 2534 return NGX_ERROR;
2553 2582
2554 return NGX_OK; 2583 return NGX_OK;
2555 } 2584 }
2556 2585
2557 if (ch == CR || ch == LF) { 2586 if (ch == CR || ch == LF) {
2587 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2588 "client sent header \"%*s\" with "
2589 "invalid value: \"%*s\\%c...\"",
2590 r->header_name_end - r->header_name_start,
2591 r->header_name_start,
2592 p - r->header_start,
2593 r->header_start,
2594 ch == CR ? 'r' : 'n');
2595
2558 return NGX_HTTP_PARSE_INVALID_HEADER; 2596 return NGX_HTTP_PARSE_INVALID_HEADER;
2559 } 2597 }
2560 2598
2561 p++; 2599 p++;
2562 } 2600 }
2577 2615
2578 2616
2579 static ngx_int_t 2617 static ngx_int_t
2580 ngx_http_spdy_alloc_large_header_buffer(ngx_http_request_t *r) 2618 ngx_http_spdy_alloc_large_header_buffer(ngx_http_request_t *r)
2581 { 2619 {
2582 u_char *old, *new; 2620 u_char *old, *new, *p;
2583 size_t rest; 2621 size_t rest;
2584 ngx_buf_t *buf; 2622 ngx_buf_t *buf;
2585 ngx_http_spdy_stream_t *stream; 2623 ngx_http_spdy_stream_t *stream;
2586 ngx_http_core_srv_conf_t *cscf; 2624 ngx_http_core_srv_conf_t *cscf;
2587 2625
2593 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 2631 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
2594 2632
2595 if (stream->header_buffers 2633 if (stream->header_buffers
2596 == (ngx_uint_t) cscf->large_client_header_buffers.num) 2634 == (ngx_uint_t) cscf->large_client_header_buffers.num)
2597 { 2635 {
2636 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2637 "client sent too large request");
2638
2598 return NGX_DECLINED; 2639 return NGX_DECLINED;
2599 } 2640 }
2600 2641
2601 rest = r->header_in->last - r->header_in->pos; 2642 rest = r->header_in->last - r->header_in->pos;
2602 2643
2644 /*
2645 * equality is prohibited since one more byte is needed
2646 * for null-termination
2647 */
2603 if (rest >= cscf->large_client_header_buffers.size) { 2648 if (rest >= cscf->large_client_header_buffers.size) {
2649 p = r->header_in->pos;
2650
2651 if (rest > NGX_MAX_ERROR_STR - 300) {
2652 rest = NGX_MAX_ERROR_STR - 300;
2653 p[rest++] = '.'; p[rest++] = '.'; p[rest++] = '.';
2654 }
2655
2656 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2657 "client sent too long header name or value: \"%*s\"",
2658 rest, p);
2659
2604 return NGX_DECLINED; 2660 return NGX_DECLINED;
2605 } 2661 }
2606 2662
2607 buf = ngx_create_temp_buf(r->pool, cscf->large_client_header_buffers.size); 2663 buf = ngx_create_temp_buf(r->pool, cscf->large_client_header_buffers.size);
2608 if (buf == NULL) { 2664 if (buf == NULL) {
2609 return NGX_ERROR; 2665 return NGX_ERROR;
2610 } 2666 }
2611 2667
2612 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2668 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2613 "spdy large header alloc: %p %z", 2669 "spdy large header alloc: %p %uz",
2614 buf->pos, buf->end - buf->last); 2670 buf->pos, buf->end - buf->last);
2615 2671
2616 old = r->header_in->pos; 2672 old = r->header_in->pos;
2617 new = buf->pos; 2673 new = buf->pos;
2618 2674
2662 continue; 2718 continue;
2663 } 2719 }
2664 2720
2665 return sh->handler(r); 2721 return sh->handler(r);
2666 } 2722 }
2723
2724 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2725 "client sent invalid header name: \":%*s\"",
2726 r->header_end - r->header_name_start,
2727 r->header_name_start);
2667 2728
2668 return NGX_HTTP_PARSE_INVALID_HEADER; 2729 return NGX_HTTP_PARSE_INVALID_HEADER;
2669 } 2730 }
2670 2731
2671 h = ngx_list_push(&r->headers_in.headers); 2732 h = ngx_list_push(&r->headers_in.headers);
2733 { 5, "PATCH", NGX_HTTP_PATCH }, 2794 { 5, "PATCH", NGX_HTTP_PATCH },
2734 { 5, "TRACE", NGX_HTTP_TRACE } 2795 { 5, "TRACE", NGX_HTTP_TRACE }
2735 }, *test; 2796 }, *test;
2736 2797
2737 if (r->method_name.len) { 2798 if (r->method_name.len) {
2799 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2800 "client sent duplicate :method header");
2801
2738 return NGX_HTTP_PARSE_INVALID_HEADER; 2802 return NGX_HTTP_PARSE_INVALID_HEADER;
2739 } 2803 }
2740 2804
2741 len = r->header_end - r->header_start; 2805 len = r->header_end - r->header_start;
2742 2806
2770 p = r->method_name.data; 2834 p = r->method_name.data;
2771 2835
2772 do { 2836 do {
2773 if ((*p < 'A' || *p > 'Z') && *p != '_') { 2837 if ((*p < 'A' || *p > 'Z') && *p != '_') {
2774 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 2838 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2775 "client sent invalid method"); 2839 "client sent invalid method: \"%V\"",
2840 &r->method_name);
2841
2776 return NGX_HTTP_PARSE_INVALID_HEADER; 2842 return NGX_HTTP_PARSE_INVALID_HEADER;
2777 } 2843 }
2778 2844
2779 p++; 2845 p++;
2780 2846
2786 2852
2787 static ngx_int_t 2853 static ngx_int_t
2788 ngx_http_spdy_parse_scheme(ngx_http_request_t *r) 2854 ngx_http_spdy_parse_scheme(ngx_http_request_t *r)
2789 { 2855 {
2790 if (r->schema_start) { 2856 if (r->schema_start) {
2857 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2858 "client sent duplicate :schema header");
2859
2791 return NGX_HTTP_PARSE_INVALID_HEADER; 2860 return NGX_HTTP_PARSE_INVALID_HEADER;
2792 } 2861 }
2793 2862
2794 r->schema_start = r->header_start; 2863 r->schema_start = r->header_start;
2795 r->schema_end = r->header_end; 2864 r->schema_end = r->header_end;
2802 ngx_http_spdy_parse_host(ngx_http_request_t *r) 2871 ngx_http_spdy_parse_host(ngx_http_request_t *r)
2803 { 2872 {
2804 ngx_table_elt_t *h; 2873 ngx_table_elt_t *h;
2805 2874
2806 if (r->headers_in.host) { 2875 if (r->headers_in.host) {
2876 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2877 "client sent duplicate :host header");
2878
2807 return NGX_HTTP_PARSE_INVALID_HEADER; 2879 return NGX_HTTP_PARSE_INVALID_HEADER;
2808 } 2880 }
2809 2881
2810 h = ngx_list_push(&r->headers_in.headers); 2882 h = ngx_list_push(&r->headers_in.headers);
2811 if (h == NULL) { 2883 if (h == NULL) {
2830 2902
2831 static ngx_int_t 2903 static ngx_int_t
2832 ngx_http_spdy_parse_path(ngx_http_request_t *r) 2904 ngx_http_spdy_parse_path(ngx_http_request_t *r)
2833 { 2905 {
2834 if (r->unparsed_uri.len) { 2906 if (r->unparsed_uri.len) {
2907 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2908 "client sent duplicate :path header");
2909
2835 return NGX_HTTP_PARSE_INVALID_HEADER; 2910 return NGX_HTTP_PARSE_INVALID_HEADER;
2836 } 2911 }
2837 2912
2838 r->uri_start = r->header_start; 2913 r->uri_start = r->header_start;
2839 r->uri_end = r->header_end; 2914 r->uri_end = r->header_end;
2840 2915
2841 if (ngx_http_parse_uri(r) != NGX_OK) { 2916 if (ngx_http_parse_uri(r) != NGX_OK) {
2917 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2918 "client sent invalid URI: \"%*s\"",
2919 r->uri_end - r->uri_start, r->uri_start);
2920
2842 return NGX_HTTP_PARSE_INVALID_HEADER; 2921 return NGX_HTTP_PARSE_INVALID_HEADER;
2843 } 2922 }
2844 2923
2845 if (ngx_http_process_request_uri(r) != NGX_OK) { 2924 if (ngx_http_process_request_uri(r) != NGX_OK) {
2846 /* 2925 /*
2858 ngx_http_spdy_parse_version(ngx_http_request_t *r) 2937 ngx_http_spdy_parse_version(ngx_http_request_t *r)
2859 { 2938 {
2860 u_char *p, ch; 2939 u_char *p, ch;
2861 2940
2862 if (r->http_protocol.len) { 2941 if (r->http_protocol.len) {
2942 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
2943 "client sent duplicate :version header");
2944
2863 return NGX_HTTP_PARSE_INVALID_HEADER; 2945 return NGX_HTTP_PARSE_INVALID_HEADER;
2864 } 2946 }
2865 2947
2866 p = r->header_start; 2948 p = r->header_start;
2867 2949
2868 if (r->header_end - p < 8 || !(ngx_str5cmp(p, 'H', 'T', 'T', 'P', '/'))) { 2950 if (r->header_end - p < 8 || !(ngx_str5cmp(p, 'H', 'T', 'T', 'P', '/'))) {
2869 return NGX_HTTP_PARSE_INVALID_HEADER; 2951 goto invalid;
2870 } 2952 }
2871 2953
2872 ch = *(p + 5); 2954 ch = *(p + 5);
2873 2955
2874 if (ch < '1' || ch > '9') { 2956 if (ch < '1' || ch > '9') {
2875 return NGX_HTTP_PARSE_INVALID_HEADER; 2957 goto invalid;
2876 } 2958 }
2877 2959
2878 r->http_major = ch - '0'; 2960 r->http_major = ch - '0';
2879 2961
2880 for (p += 6; p != r->header_end - 2; p++) { 2962 for (p += 6; p != r->header_end - 2; p++) {
2884 if (ch == '.') { 2966 if (ch == '.') {
2885 break; 2967 break;
2886 } 2968 }
2887 2969
2888 if (ch < '0' || ch > '9') { 2970 if (ch < '0' || ch > '9') {
2889 return NGX_HTTP_PARSE_INVALID_HEADER; 2971 goto invalid;
2890 } 2972 }
2891 2973
2892 r->http_major = r->http_major * 10 + ch - '0'; 2974 r->http_major = r->http_major * 10 + ch - '0';
2893 } 2975 }
2894 2976
2895 if (*p != '.') { 2977 if (*p != '.') {
2896 return NGX_HTTP_PARSE_INVALID_HEADER; 2978 goto invalid;
2897 } 2979 }
2898 2980
2899 ch = *(p + 1); 2981 ch = *(p + 1);
2900 2982
2901 if (ch < '0' || ch > '9') { 2983 if (ch < '0' || ch > '9') {
2902 return NGX_HTTP_PARSE_INVALID_HEADER; 2984 goto invalid;
2903 } 2985 }
2904 2986
2905 r->http_minor = ch - '0'; 2987 r->http_minor = ch - '0';
2906 2988
2907 for (p += 2; p != r->header_end; p++) { 2989 for (p += 2; p != r->header_end; p++) {
2908 2990
2909 ch = *p; 2991 ch = *p;
2910 2992
2911 if (ch < '0' || ch > '9') { 2993 if (ch < '0' || ch > '9') {
2912 return NGX_HTTP_PARSE_INVALID_HEADER; 2994 goto invalid;
2913 } 2995 }
2914 2996
2915 r->http_minor = r->http_minor * 10 + ch - '0'; 2997 r->http_minor = r->http_minor * 10 + ch - '0';
2916 } 2998 }
2917 2999
2918 r->http_protocol.len = r->header_end - r->header_start; 3000 r->http_protocol.len = r->header_end - r->header_start;
2919 r->http_protocol.data = r->header_start; 3001 r->http_protocol.data = r->header_start;
2920 r->http_version = r->http_major * 1000 + r->http_minor; 3002 r->http_version = r->http_major * 1000 + r->http_minor;
2921 3003
2922 return NGX_OK; 3004 return NGX_OK;
3005
3006 invalid:
3007
3008 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
3009 "client sent invalid http version: \"%*s\"",
3010 r->header_end - r->header_start, r->header_start);
3011
3012 return NGX_HTTP_PARSE_INVALID_HEADER;
2923 } 3013 }
2924 3014
2925 3015
2926 static ngx_int_t 3016 static ngx_int_t
2927 ngx_http_spdy_construct_request_line(ngx_http_request_t *r) 3017 ngx_http_spdy_construct_request_line(ngx_http_request_t *r)
3005 if (hh && hh->handler(r, &h[i], hh->offset) != NGX_OK) { 3095 if (hh && hh->handler(r, &h[i], hh->offset) != NGX_OK) {
3006 return; 3096 return;
3007 } 3097 }
3008 3098
3009 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 3099 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3010 "http header: \"%V: %V\"", &h[i].key, &h[i].value); 3100 "spdy http header: \"%V: %V\"", &h[i].key, &h[i].value);
3011 } 3101 }
3012 3102
3013 r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE; 3103 r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
3014 3104
3015 if (ngx_http_process_request_header(r) != NGX_OK) { 3105 if (ngx_http_process_request_header(r) != NGX_OK) {
3267 3357
3268 ev = fc->read; 3358 ev = fc->read;
3269 3359
3270 if (ev->active || ev->disabled) { 3360 if (ev->active || ev->disabled) {
3271 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, 3361 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0,
3272 "spdy fake read event was activated"); 3362 "fake read event was activated");
3273 } 3363 }
3274 3364
3275 if (ev->timer_set) { 3365 if (ev->timer_set) {
3276 ngx_del_timer(ev); 3366 ngx_del_timer(ev);
3277 } 3367 }
3282 3372
3283 ev = fc->write; 3373 ev = fc->write;
3284 3374
3285 if (ev->active || ev->disabled) { 3375 if (ev->active || ev->disabled) {
3286 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0, 3376 ngx_log_error(NGX_LOG_ALERT, sc->connection->log, 0,
3287 "spdy fake write event was activated"); 3377 "fake write event was activated");
3288 } 3378 }
3289 3379
3290 if (ev->timer_set) { 3380 if (ev->timer_set) {
3291 ngx_del_timer(ev); 3381 ngx_del_timer(ev);
3292 } 3382 }