| 12504 | } |
| 12505 | |
| 12506 | ada_really_inline void url::parse_path(std::string_view input) { |
| 12507 | ada_log("parse_path ", input); |
| 12508 | std::string tmp_buffer; |
| 12509 | std::string_view internal_input; |
| 12510 | if (unicode::has_tabs_or_newline(input)) { |
| 12511 | tmp_buffer = input; |
| 12512 | // Optimization opportunity: Instead of copying and then pruning, we could |
| 12513 | // just directly build the string from user_input. |
| 12514 | helpers::remove_ascii_tab_or_newline(tmp_buffer); |
| 12515 | internal_input = tmp_buffer; |
| 12516 | } else { |
| 12517 | internal_input = input; |
| 12518 | } |
| 12519 | |
| 12520 | // If url is special, then: |
| 12521 | if (is_special()) { |
| 12522 | if (internal_input.empty()) { |
| 12523 | path = "/"; |
| 12524 | } else if ((internal_input[0] == '/') || (internal_input[0] == '\\')) { |
| 12525 | helpers::parse_prepared_path(internal_input.substr(1), type, path); |
| 12526 | } else { |
| 12527 | helpers::parse_prepared_path(internal_input, type, path); |
| 12528 | } |
| 12529 | } else if (!internal_input.empty()) { |
| 12530 | if (internal_input[0] == '/') { |
| 12531 | helpers::parse_prepared_path(internal_input.substr(1), type, path); |
| 12532 | } else { |
| 12533 | helpers::parse_prepared_path(internal_input, type, path); |
| 12534 | } |
| 12535 | } else { |
| 12536 | if (!host.has_value()) { |
| 12537 | path = "/"; |
| 12538 | } |
| 12539 | } |
| 12540 | } |
| 12541 | |
| 12542 | [[nodiscard]] std::string url::to_string() const { |
| 12543 | if (!is_valid) { |
nothing calls this directly
no test coverage detected