Assert that HttpHeaders instances know about indexed ids

The HttpHeaderTable::Builder class allows you to reference its future table before it is fully built. But that HttpHeaderTable must be used to make HttpHeaders instances only after HttpHeaderTable::Builder::build() is invoked under peril of index out of bounds error in debug mode or segfault in release mode. These errors can be somewhat mysterious since they usually occur on a different stack from where the HttpHeaders instance was made. This commit adds an assertion that makes this situation more evident and logs useful diagnostic info about which header id was added after the construction. Hopefully, it should downgrade a segfault to failed Promise or thrown Exception for most users.
3 files changed
tree: 4c6907081ce2391d35e0611beb7dc316734a3620
  1. .github/
  2. c++/
  3. doc/
  4. highlighting/
  5. kjdoc/
  6. security-advisories/
  7. .cirrus.yml
  8. .gitignore
  9. CMakeLists.txt
  10. CONTRIBUTORS
  11. LICENSE
  12. mega-test-kenton-home.cfg
  13. mega-test-kenton-work.cfg
  14. mega-test-quick.cfg
  15. mega-test.py
  16. README.md
  17. RELEASE-PROCESS.md
  18. release.sh
  19. style-guide.md
  20. super-test.sh
README.md

Quick Tests Release Tests

Cap‘n Proto is an insanely fast data interchange format and capability-based RPC system. Think JSON, except binary. Or think Protocol Buffers, except faster. In fact, in benchmarks, Cap’n Proto is INFINITY TIMES faster than Protocol Buffers.

Read more...