LCOV - code coverage report
Current view: top level - libs/http_proto/src/rfc - upgrade_rule.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 93.3 % 15 14
Test Date: 2025-12-05 19:49:25 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
       3              : //
       4              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6              : //
       7              : // Official repository: https://github.com/cppalliance/http_proto
       8              : //
       9              : 
      10              : #include <boost/http_proto/rfc/upgrade_rule.hpp>
      11              : #include <boost/http_proto/rfc/token_rule.hpp>
      12              : #include <boost/url/grammar/error.hpp>
      13              : #include <boost/url/grammar/parse.hpp>
      14              : 
      15              : namespace boost {
      16              : namespace http_proto {
      17              : namespace implementation_defined {
      18              : 
      19              : auto
      20           47 : upgrade_protocol_rule_t::
      21              : parse(
      22              :     char const*& it,
      23              :     char const* end) const noexcept ->
      24              :         system::result<value_type>
      25              : {
      26           47 :     value_type t;
      27              :     // token
      28              :     {
      29           47 :         auto rv = grammar::parse(
      30              :             it, end, token_rule);
      31           47 :         if(! rv)
      32            4 :             return rv.error();
      33           43 :         t.name = *rv;
      34              :     }
      35              :     // [ "/" token ]
      36           43 :     if( it == end ||
      37           11 :         *it != '/')
      38           33 :         return t;
      39           10 :     ++it;
      40           10 :     auto rv = grammar::parse(
      41              :         it, end, token_rule);
      42           10 :     if(! rv)
      43            0 :         return rv.error();
      44           10 :     t.version = *rv;
      45           10 :     return t;
      46              : }
      47              : 
      48              : } // implementation_defined
      49              : } // http_proto
      50              : } // boost
        

Generated by: LCOV version 2.1