Mercurial > hg > nginx-quic
comparison src/http/v3/ngx_http_v3_streams.c @ 8641:531075860fe2 quic
HTTP/3: removed client-side encoder support.
Dynamic tables are not used when generating responses anyway.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 06 Oct 2021 14:48:59 +0300 |
parents | d6e191a583cc |
children | 72b304f6207c |
comparison
equal
deleted
inserted
replaced
8640:c4f249d485e3 | 8641:531075860fe2 |
---|---|
478 return NGX_ERROR; | 478 return NGX_ERROR; |
479 } | 479 } |
480 | 480 |
481 | 481 |
482 ngx_int_t | 482 ngx_int_t |
483 ngx_http_v3_send_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, | |
484 ngx_uint_t index, ngx_str_t *value) | |
485 { | |
486 u_char *p, buf[NGX_HTTP_V3_PREFIX_INT_LEN * 2]; | |
487 size_t n; | |
488 ngx_connection_t *ec; | |
489 | |
490 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
491 "http3 client ref insert, %s[%ui] \"%V\"", | |
492 dynamic ? "dynamic" : "static", index, value); | |
493 | |
494 ec = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_ENCODER); | |
495 if (ec == NULL) { | |
496 return NGX_ERROR; | |
497 } | |
498 | |
499 p = buf; | |
500 | |
501 *p = (dynamic ? 0x80 : 0xc0); | |
502 p = (u_char *) ngx_http_v3_encode_prefix_int(p, index, 6); | |
503 | |
504 /* XXX option for huffman? */ | |
505 *p = 0; | |
506 p = (u_char *) ngx_http_v3_encode_prefix_int(p, value->len, 7); | |
507 | |
508 n = p - buf; | |
509 | |
510 if (ec->send(ec, buf, n) != (ssize_t) n) { | |
511 goto failed; | |
512 } | |
513 | |
514 if (ec->send(ec, value->data, value->len) != (ssize_t) value->len) { | |
515 goto failed; | |
516 } | |
517 | |
518 return NGX_OK; | |
519 | |
520 failed: | |
521 | |
522 ngx_http_v3_close_uni_stream(ec); | |
523 | |
524 return NGX_ERROR; | |
525 } | |
526 | |
527 | |
528 ngx_int_t | |
529 ngx_http_v3_send_insert(ngx_connection_t *c, ngx_str_t *name, ngx_str_t *value) | |
530 { | |
531 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; | |
532 size_t n; | |
533 ngx_connection_t *ec; | |
534 | |
535 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
536 "http3 client insert \"%V\":\"%V\"", name, value); | |
537 | |
538 ec = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_ENCODER); | |
539 if (ec == NULL) { | |
540 return NGX_ERROR; | |
541 } | |
542 | |
543 /* XXX option for huffman? */ | |
544 buf[0] = 0x40; | |
545 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, name->len, 5) - buf; | |
546 | |
547 if (ec->send(ec, buf, n) != (ssize_t) n) { | |
548 goto failed; | |
549 } | |
550 | |
551 if (ec->send(ec, name->data, name->len) != (ssize_t) name->len) { | |
552 goto failed; | |
553 } | |
554 | |
555 /* XXX option for huffman? */ | |
556 buf[0] = 0; | |
557 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, value->len, 7) - buf; | |
558 | |
559 if (ec->send(ec, buf, n) != (ssize_t) n) { | |
560 goto failed; | |
561 } | |
562 | |
563 if (ec->send(ec, value->data, value->len) != (ssize_t) value->len) { | |
564 goto failed; | |
565 } | |
566 | |
567 return NGX_OK; | |
568 | |
569 failed: | |
570 | |
571 ngx_http_v3_close_uni_stream(ec); | |
572 | |
573 return NGX_ERROR; | |
574 } | |
575 | |
576 | |
577 ngx_int_t | |
578 ngx_http_v3_send_set_capacity(ngx_connection_t *c, ngx_uint_t capacity) | |
579 { | |
580 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; | |
581 size_t n; | |
582 ngx_connection_t *ec; | |
583 | |
584 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
585 "http3 client set capacity %ui", capacity); | |
586 | |
587 ec = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_ENCODER); | |
588 if (ec == NULL) { | |
589 return NGX_ERROR; | |
590 } | |
591 | |
592 buf[0] = 0x20; | |
593 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, capacity, 5) - buf; | |
594 | |
595 if (ec->send(ec, buf, n) != (ssize_t) n) { | |
596 ngx_http_v3_close_uni_stream(ec); | |
597 return NGX_ERROR; | |
598 } | |
599 | |
600 return NGX_OK; | |
601 } | |
602 | |
603 | |
604 ngx_int_t | |
605 ngx_http_v3_send_duplicate(ngx_connection_t *c, ngx_uint_t index) | |
606 { | |
607 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; | |
608 size_t n; | |
609 ngx_connection_t *ec; | |
610 | |
611 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
612 "http3 client duplicate %ui", index); | |
613 | |
614 ec = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_ENCODER); | |
615 if (ec == NULL) { | |
616 return NGX_ERROR; | |
617 } | |
618 | |
619 buf[0] = 0; | |
620 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, index, 5) - buf; | |
621 | |
622 if (ec->send(ec, buf, n) != (ssize_t) n) { | |
623 ngx_http_v3_close_uni_stream(ec); | |
624 return NGX_ERROR; | |
625 } | |
626 | |
627 return NGX_OK; | |
628 } | |
629 | |
630 | |
631 ngx_int_t | |
632 ngx_http_v3_send_ack_section(ngx_connection_t *c, ngx_uint_t stream_id) | 483 ngx_http_v3_send_ack_section(ngx_connection_t *c, ngx_uint_t stream_id) |
633 { | 484 { |
634 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; | 485 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; |
635 size_t n; | 486 size_t n; |
636 ngx_connection_t *dc; | 487 ngx_connection_t *dc; |