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

Function url_parse_http

src/proxy/hdrs/URL.cc:1402–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1400// empties params/query/fragment component
1401
1402ParseResult
1403url_parse_http(HdrHeap *heap, URLImpl *url, const char **start, const char *end, bool copy_strings, bool verify_host_characters)
1404{
1405 ParseResult err;
1406 const char *cur;
1407 const char *path_start = nullptr;
1408 const char *path_end = nullptr;
1409 const char *query_start = nullptr;
1410 const char *query_end = nullptr;
1411 const char *fragment_start = nullptr;
1412 const char *fragment_end = nullptr;
1413 char mask;
1414
1415 err = url_parse_internet(heap, url, start, end, copy_strings, verify_host_characters);
1416 if (err < 0) {
1417 return err;
1418 }
1419
1420 cur = *start;
1421 bool nothing_after_host = false;
1422 if (*start == end) {
1423 nothing_after_host = true;
1424 goto done;
1425 }
1426
1427 if (*cur == '/') {
1428 path_start = cur;
1429 }
1430 mask = '?' & '#';
1431parse_path2:
1432 if ((*cur & mask) == mask) {
1433 if (*cur == '?') {
1434 path_end = cur;
1435 goto parse_query1;
1436 }
1437 if (*cur == '#') {
1438 path_end = cur;
1439 goto parse_fragment1;
1440 }
1441 } else {
1442 ink_assert((*cur != '?') && (*cur != '#'));
1443 }
1444 GETNEXT(done);
1445 goto parse_path2;
1446
1447parse_query1:
1448 query_start = cur + 1;
1449 GETNEXT(done);
1450parse_query2:
1451 if (*cur == '#') {
1452 query_end = cur;
1453 goto parse_fragment1;
1454 }
1455 GETNEXT(done);
1456 goto parse_query2;
1457
1458parse_fragment1:
1459 fragment_start = cur + 1;

Callers 1

url_parseFunction · 0.85

Calls 4

url_parse_internetFunction · 0.85
set_pathMethod · 0.80
set_queryMethod · 0.80
set_fragmentMethod · 0.80

Tested by

no test coverage detected