Commit 2494c46
ip_representation::operator< + http_request_impl::populate_all_cert_fields
Two unrelated functions, both at CCN 18; refactor bundled because the
shape of each extraction is small.
ip_representation::operator< (CCN 18 -> 7):
* accumulate_octet_score: shared "(16-i)*piece[i]" accumulator used
by the main 0..15 sweep (skipping 10/11) and again for the 10..11
tail. Pulls the two CHECK_BIT clauses out of three different sites.
* is_v4_mapped_prefix_octet_pair: collapses the nested
"((a == 0x00 || a == 0xFF) && (b == 0x00 || b == 0xFF))" check
into a named predicate. The composite if at the top of operator<
was contributing 8 boolean ops alone.
http_request_impl::populate_all_cert_fields (CCN 18 -> 5):
* extract_x509_string: parameterised two-pass GnuTLS string getter
(function pointer takes gnutls_x509_crt_get_dn or
gnutls_x509_crt_get_issuer_dn -- same signature, identical wrapping).
* extract_x509_common_name: get_dn_by_oid wrapper (separate because
of the extra OID/index/flags parameters).
* extract_x509_fingerprint_sha256: fingerprint hex-encode.
* verify_peer_certificate: wraps gnutls_certificate_verify_peers2 and
returns the verified bool.
populate_all_cert_fields now reads as a flat sequence: assign to each
pmr::string member via the per-field helper, then the two int64_t
validity times. The cross-allocator .assign(ptr, len) idiom is preserved.
Both refactors are HAVE_GNUTLS-gated in the case of cert handling;
local build skips it but the helpers still compile-test against the
operator< side of the change, and CI's GNUTLS-on lane exercises the
cert path end to end.
scripts/check-complexity.sh CCN_MAX ratcheted 19 -> 15 (new worst
offender is webserver::register_impl_ at CCN 14).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 368bf85 commit 2494c46
3 files changed
Lines changed: 101 additions & 81 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 | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
488 | | - | |
489 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
490 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
491 | 546 | | |
| 547 | + | |
| 548 | + | |
492 | 549 | | |
493 | 550 | | |
494 | 551 | | |
495 | | - | |
496 | | - | |
497 | | - | |
| 552 | + | |
498 | 553 | | |
499 | 554 | | |
500 | | - | |
501 | | - | |
502 | | - | |
| 555 | + | |
503 | 556 | | |
504 | 557 | | |
505 | 558 | | |
506 | 559 | | |
507 | 560 | | |
508 | 561 | | |
509 | 562 | | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 563 | + | |
517 | 564 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
530 | 569 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
| 570 | + | |
| 571 | + | |
541 | 572 | | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
| 573 | + | |
| 574 | + | |
554 | 575 | | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
| 576 | + | |
| 577 | + | |
571 | 578 | | |
572 | 579 | | |
573 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
543 | 564 | | |
544 | 565 | | |
545 | 566 | | |
546 | 567 | | |
547 | 568 | | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
| 569 | + | |
553 | 570 | | |
554 | 571 | | |
555 | | - | |
556 | | - | |
557 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
558 | 575 | | |
559 | 576 | | |
560 | 577 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 578 | + | |
| 579 | + | |
567 | 580 | | |
568 | 581 | | |
569 | 582 | | |
| |||
0 commit comments