changeset 8356:42198f77ac85 quic

Removed support of drafts older than currently latest 27.
author Vladimir Homutov <vl@nginx.com>
date Thu, 23 Apr 2020 11:50:20 +0300
parents ad3a6f069498
children 05b8dd5d9f7e
files src/event/ngx_event_quic.c src/event/ngx_event_quic_transport.c
diffstat 2 files changed, 1 insertions(+), 97 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -1903,10 +1903,6 @@ ngx_quic_crypto_input(ngx_connection_t *
         ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
                        "handshake completed successfully");
 
-#if (NGX_QUIC_DRAFT_VERSION >= 27)
-        {
-        ngx_quic_frame_t  *frame;
-
         frame = ngx_quic_alloc_frame(c, 0);
         if (frame == NULL) {
             return NGX_ERROR;
@@ -1917,8 +1913,6 @@ ngx_quic_crypto_input(ngx_connection_t *
         frame->type = NGX_QUIC_FT_HANDSHAKE_DONE;
         ngx_sprintf(frame->info, "HANDSHAKE DONE on handshake completed");
         ngx_quic_queue_frame(c->quic, frame);
-        }
-#endif
 
         /*
          * Generating next keys before a key update is received.
--- a/src/event/ngx_event_quic_transport.c
+++ b/src/event/ngx_event_quic_transport.c
@@ -61,7 +61,6 @@ static u_char *ngx_quic_parse_int_multi(
 static void ngx_quic_build_int(u_char **pos, uint64_t value);
 
 static u_char *ngx_quic_read_uint8(u_char *pos, u_char *end, uint8_t *value);
-/*static*/ u_char *ngx_quic_read_uint16(u_char *pos, u_char *end, uint16_t *value); // usage depends on NGX_QUIC_VERSION
 static u_char *ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value);
 static u_char *ngx_quic_read_bytes(u_char *pos, u_char *end, size_t len,
     u_char **out);
@@ -182,19 +181,6 @@ ngx_quic_read_uint8(u_char *pos, u_char 
 }
 
 
-/*static*/ ngx_inline u_char *
-ngx_quic_read_uint16(u_char *pos, u_char *end, uint16_t *value)
-{
-    if ((size_t)(end - pos) < sizeof(uint16_t)) {
-        return NULL;
-    }
-
-    *value = ngx_quic_parse_uint16(pos);
-
-    return pos + sizeof(uint16_t);
-}
-
-
 static ngx_inline u_char *
 ngx_quic_read_uint32(u_char *pos, u_char *end, uint32_t *value)
 {
@@ -1452,55 +1438,9 @@ ngx_int_t
 ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp,
     ngx_log_t *log)
 {
+    uint64_t   id, len;
     ngx_int_t  rc;
 
-#if (NGX_QUIC_DRAFT_VERSION < 27)
-
-    uint16_t  id, len, tp_len;
-
-    p = ngx_quic_read_uint16(p, end, &tp_len);
-    if (p == NULL) {
-        ngx_log_error(NGX_LOG_INFO, log, 0,
-                      "failed to parse total transport params length");
-        return NGX_ERROR;
-    }
-
-    while (p < end) {
-
-        p = ngx_quic_read_uint16(p, end, &id);
-        if (p == NULL) {
-            ngx_log_error(NGX_LOG_INFO, log, 0,
-                          "failed to parse transport param id");
-            return NGX_ERROR;
-        }
-
-        p = ngx_quic_read_uint16(p, end, &len);
-        if (p == NULL) {
-            ngx_log_error(NGX_LOG_INFO, log, 0,
-                         "failed to parse transport param id 0x%xi length", id);
-            return NGX_ERROR;
-        }
-
-        rc = ngx_quic_parse_transport_param(p, p + len, id, tp);
-
-        if (rc == NGX_ERROR) {
-            ngx_log_error(NGX_LOG_INFO, log, 0,
-                          "failed to parse transport param id 0x%xi data", id);
-            return NGX_ERROR;
-        }
-
-        if (rc == NGX_DECLINED) {
-            ngx_log_error(NGX_LOG_INFO, log, 0,
-                          "unknown transport param id 0x%xi, skipped", id);
-        }
-
-        p += len;
-    };
-
-#else
-
-    uint64_t  id, len;
-
     while (p < end) {
         p = ngx_quic_parse_int(p, end, &id);
         if (p == NULL) {
@@ -1530,11 +1470,8 @@ ngx_quic_parse_transport_params(u_char *
         }
 
         p += len;
-
     }
 
-#endif
-
     if (p != end) {
         ngx_log_error(NGX_LOG_INFO, log, 0,
                       "trailing garbage in transport parameters: %ui bytes",
@@ -1542,7 +1479,6 @@ ngx_quic_parse_transport_params(u_char *
         return NGX_ERROR;
     }
 
-
     ngx_log_debug0(NGX_LOG_DEBUG_EVENT, log, 0,
                    "client transport parameters parsed successfully");
 
@@ -1641,22 +1577,6 @@ ngx_quic_create_transport_params(u_char 
     u_char  *p;
     size_t   len;
 
-#if (NGX_QUIC_DRAFT_VERSION < 27)
-
-/* older drafts with static transport parameters encoding */
-
-#define ngx_quic_tp_len(id, value)                                            \
-    4 + ngx_quic_varint_len(value)
-
-#define ngx_quic_tp_vint(id, value)                                           \
-    do {                                                                      \
-        p = ngx_quic_write_uint16(p, id);                                     \
-        p = ngx_quic_write_uint16(p, ngx_quic_varint_len(value));             \
-        ngx_quic_build_int(&p, value);                                        \
-    } while (0)
-
-#else
-
 /* recent drafts with variable integer transport parameters encoding */
 
 #define ngx_quic_tp_len(id, value)                                            \
@@ -1671,8 +1591,6 @@ ngx_quic_create_transport_params(u_char 
         ngx_quic_build_int(&p, value);                                        \
     } while (0)
 
-#endif
-
     p = pos;
 
     len = ngx_quic_tp_len(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
@@ -1699,17 +1617,9 @@ ngx_quic_create_transport_params(u_char 
                            tp->max_idle_timeout);
 
     if (pos == NULL) {
-#if (NGX_QUIC_DRAFT_VERSION < 27)
-        len += 2;
-#endif
         return len;
     }
 
-#if (NGX_QUIC_DRAFT_VERSION < 27)
-    /* TLS extension length */
-    p = ngx_quic_write_uint16(p, len);
-#endif
-
     ngx_quic_tp_vint(NGX_QUIC_TP_ACTIVE_CONNECTION_ID_LIMIT,
                      tp->active_connection_id_limit);