MCPcopy Create free account
hub / github.com/apache/brpc / http_parse_host_char

Function http_parse_host_char

src/brpc/details/http_parser.cpp:2204–2267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2202}
2203
2204static enum http_host_state
2205http_parse_host_char(enum http_host_state s, const char ch) {
2206 switch(s) {
2207 case s_http_userinfo:
2208 case s_http_userinfo_start:
2209 if (ch == '@') {
2210 return s_http_host_start;
2211 }
2212
2213 if (IS_USERINFO_CHAR(ch)) {
2214 return s_http_userinfo;
2215 }
2216 break;
2217
2218 case s_http_host_start:
2219 if (ch == '[') {
2220 return s_http_host_v6_start;
2221 }
2222
2223 if (IS_HOST_CHAR(ch)) {
2224 return s_http_host;
2225 }
2226
2227 break;
2228
2229 case s_http_host:
2230 if (IS_HOST_CHAR(ch)) {
2231 return s_http_host;
2232 }
2233
2234 /* FALLTHROUGH */
2235 case s_http_host_v6_end:
2236 if (ch == ':') {
2237 return s_http_host_port_start;
2238 }
2239
2240 break;
2241
2242 case s_http_host_v6:
2243 if (ch == ']') {
2244 return s_http_host_v6_end;
2245 }
2246
2247 /* FALLTHROUGH */
2248 case s_http_host_v6_start:
2249 if (IS_HEX(ch) || ch == ':' || ch == '.') {
2250 return s_http_host_v6;
2251 }
2252
2253 break;
2254
2255 case s_http_host_port:
2256 case s_http_host_port_start:
2257 if (IS_NUM(ch)) {
2258 return s_http_host_port;
2259 }
2260
2261 break;

Callers 1

http_parse_hostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected