MCPcopy Create free account
hub / github.com/apache/trafficserver / validate_hdr_request_target

Function validate_hdr_request_target

src/proxy/hdrs/HTTP.cc:1179–1208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177}
1178
1179ParseResult
1180validate_hdr_request_target(int method_wk_idx, URLImpl *url)
1181{
1182 ParseResult ret = PARSE_RESULT_DONE;
1183 int host_len;
1184 url->get_host(&host_len);
1185 int path_len;
1186 const char *path = url->get_path(&path_len);
1187 int scheme_len;
1188 url->get_scheme(&scheme_len);
1189
1190 if (host_len == 0) {
1191 if (path_len == 1 && path[0] == '*') { // asterisk-form
1192 // Skip this check for now because URLImpl can't distinguish '*' and '/*'
1193 // if (method_wk_idx != HTTP_WKSIDX_OPTIONS) {
1194 // ret = PARSE_RESULT_ERROR;
1195 // }
1196 } else { // origin-form
1197 // Nothing to check here
1198 }
1199 } else if (scheme_len == 0 && host_len != 0) { // authority-form
1200 if (method_wk_idx != HTTP_WKSIDX_CONNECT) {
1201 ret = PARSE_RESULT_ERROR;
1202 }
1203 } else { // absolute-form
1204 // Nothing to check here
1205 }
1206
1207 return ret;
1208}
1209
1210ParseResult
1211validate_hdr_host(HTTPHdrImpl *hh)

Callers 1

http_parser_parse_reqFunction · 0.85

Calls 3

get_schemeMethod · 0.80
get_hostMethod · 0.45
get_pathMethod · 0.45

Tested by

no test coverage detected