Commit 5b86daf
http_endpoint: decompose string ctor under the CCN 10 bar (22 -> 7)
http_endpoint::http_endpoint(const string&, bool, bool, bool) was a
75-line registration-time URL parser doing case-insensitive lowercase,
slash normalization, per-piece dispatch between non-registration /
literal / parameter modes, and optional regex compilation. CCN 22.
Decomposed into private member helpers:
normalize_url_complete trim trailing '/', ensure leading '/'
process_url_part per-iteration mode dispatch
append_non_registration_part verbatim push to url_pieces
append_literal_url_part literal piece, respect '^' anchor
append_parameter_url_part "{name}" / "{name|regex}" parse
compile_regex_url trailing '$' + std::regex compile
The ctor itself drops to CCN 7: throw-if-regex-without-registration,
seed url_normalized, lowercase if CASE_INSENSITIVE, normalize slashes,
tokenize, loop over parts calling process_url_part, compile_regex if
requested. Every new helper sits at CCN <= 7.
Behaviour preserved verbatim: the leading-'^' anchor on the first
literal piece still REPLACES url_normalized's seed (rather than
appending), the parameter-mode validation still throws on parts of
size <3 or missing braces, and compile_regex_url still throws via
the same std::regex::extended | icase | nosubs path.
Verified locally: full `make check`.
scripts/check-complexity.sh CCN_MAX ratcheted 23 -> 22 (the new worst
offender is webserver_impl::post_iterator at CCN 21).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent adba72d commit 5b86daf
3 files changed
Lines changed: 86 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
45 | 112 | | |
46 | 113 | | |
47 | 114 | | |
48 | 115 | | |
49 | 116 | | |
50 | 117 | | |
51 | | - | |
52 | 118 | | |
53 | | - | |
54 | 119 | | |
55 | 120 | | |
56 | 121 | | |
57 | 122 | | |
58 | 123 | | |
59 | 124 | | |
| 125 | + | |
60 | 126 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 127 | + | |
71 | 128 | | |
72 | | - | |
73 | 129 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 130 | + | |
108 | 131 | | |
109 | 132 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
189 | 203 | | |
190 | 204 | | |
191 | 205 | | |
| |||
0 commit comments