[squid-dev] [PATCH] HttpHeader migration (coverity-fixes branch)

Kinkie gkinkie at gmail.com
Tue Aug 4 11:22:39 UTC 2015


Hi all,
  the attached patch is a build- and run-tested merge proposal for next
round of the coverity-fixes branch, currently focusing on more effective
header name -> id lookups.

Here's the status with the current todo checklist:

 * DONE 1. shift HDR_BAD_HDR to end of enum
 * DONE 2. shift headers data array to http/RegistredHeaders.cc
 * DONE 3. creatign LookupTable object from teh enum and array
 * (with HDR_BAD_HDR as invalid value)
 * DONE 4. replacing httpHeaderIdByName() uses with the lookup table
 * NOT POSSIBLE 5. merge HDR_BAD_HDR and HDR_ENUM_END into one thing -
HDR_ENUM_END is overloaded meaning "All" headers in Manglers.
 * DONE 6. replacing httpHeaderNameById with direct array lookups
 * DONE 7. being looking at the other arrays removal

In working on this I found out several instances of enum abuses - tracking
those down has been the hardest part of the effort.
HttpHeader::parse is being used to parse error page templates - thus the
relaxed any_registered_header() checks in some methods, e.g.
HttpHdeader::addEntry().

Next steps, if there is consensus:
- moving LookupTable away from std::map to std::hash with custom
gperf-derived Hashers for extra boost
- investigating whether strongly-typed enums can be used instead of C-style
enums in more places.
- moving away from homegrown bitfields (CBIT_TEST etc.) towards
std::vector<bool> or std::vector<unsigned char>, possibly via a class
bitfield or somesuch.

-- 
    Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150804/5f549488/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coverity-fixes-3-v2.patch
Type: application/octet-stream
Size: 77890 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150804/5f549488/attachment-0001.obj>


More information about the squid-dev mailing list