Strips parameters from value. Returns cleared TextView if a q=f parameter present, where f is less than or equal to zero.
| 48 | // zero. |
| 49 | // |
| 50 | void |
| 51 | strip_ae_value(swoc::TextView &value) |
| 52 | { |
| 53 | swoc::TextView compression{value.take_prefix_at(';')}; |
| 54 | compression.trim(" \t"); |
| 55 | while (value) { |
| 56 | swoc::TextView param{value.take_prefix_at(';')}; |
| 57 | swoc::TextView name{param.take_prefix_at('=')}; |
| 58 | name.trim(" \t"); |
| 59 | if (strcasecmp("q", name) == 0) { |
| 60 | // If q value is valid and is zero, suppress compression types. |
| 61 | param.trim(" \t"); |
| 62 | if (param) { |
| 63 | swoc::TextView whole{param.take_prefix_at('.')}; |
| 64 | whole.ltrim(" \t"); |
| 65 | if ("0" == whole) { |
| 66 | param.trim('0'); |
| 67 | if (!param) { |
| 68 | // Suppress compression type. |
| 69 | compression.clear(); |
| 70 | break; |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | value = compression; |
| 77 | } |
| 78 | } // end anonymous namespace |
| 79 | |
| 80 | void |
no test coverage detected