| 121 | namespace HttpForwarded |
| 122 | { |
| 123 | OptionBitSet |
| 124 | optStrToBitset(std::string_view optConfigStr, swoc::FixedBufferWriter &error) |
| 125 | { |
| 126 | const swoc::TextView Delimiters(":|"); |
| 127 | |
| 128 | OptionBitSet optBS; |
| 129 | |
| 130 | // Convert to TS TextView to be able to use parsing members. |
| 131 | // |
| 132 | swoc::TextView oCS{optConfigStr}; |
| 133 | |
| 134 | if (eqIgnoreCaseWs(oCS, "none")) { |
| 135 | return OptionBitSet(); |
| 136 | } |
| 137 | |
| 138 | BadOptionsErrMsg em(error); |
| 139 | |
| 140 | do { |
| 141 | swoc::TextView optStr = oCS.take_prefix_at(Delimiters); |
| 142 | |
| 143 | if (eqIgnoreCaseWs(optStr, "for")) { |
| 144 | optBS.set(FOR); |
| 145 | |
| 146 | } else if (eqIgnoreCaseWs(optStr, "by=ip")) { |
| 147 | optBS.set(BY_IP); |
| 148 | |
| 149 | } else if (eqIgnoreCaseWs(optStr, "by=unknown")) { |
| 150 | optBS.set(BY_UNKNOWN); |
| 151 | |
| 152 | } else if (eqIgnoreCaseWs(optStr, "by=servername")) { |
| 153 | optBS.set(BY_SERVER_NAME); |
| 154 | |
| 155 | } else if (eqIgnoreCaseWs(optStr, "by=uuid")) { |
| 156 | optBS.set(BY_UUID); |
| 157 | |
| 158 | } else if (eqIgnoreCaseWs(optStr, "proto")) { |
| 159 | optBS.set(PROTO); |
| 160 | |
| 161 | } else if (eqIgnoreCaseWs(optStr, "host")) { |
| 162 | optBS.set(HOST); |
| 163 | |
| 164 | } else if (eqIgnoreCaseWs(optStr, "connection=compact")) { |
| 165 | optBS.set(CONNECTION_COMPACT); |
| 166 | |
| 167 | } else if (eqIgnoreCaseWs(optStr, "connection=std")) { |
| 168 | optBS.set(CONNECTION_STD); |
| 169 | |
| 170 | } else if (eqIgnoreCaseWs(optStr, "connection=standard")) { |
| 171 | optBS.set(CONNECTION_STD); |
| 172 | |
| 173 | } else if (eqIgnoreCaseWs(optStr, "connection=full")) { |
| 174 | optBS.set(CONNECTION_FULL); |
| 175 | |
| 176 | } else { |
| 177 | em.add(optStr); |
| 178 | } |
| 179 | } while (oCS); |
| 180 | |