Skip to content

Cleanup: Use string_view in URL and HTTPHdr#12243

Merged
bryancall merged 43 commits into
apache:masterfrom
hnakamur:use_string_view_in_url_and_httphdr
Jun 18, 2025
Merged

Cleanup: Use string_view in URL and HTTPHdr#12243
bryancall merged 43 commits into
apache:masterfrom
hnakamur:use_string_view_in_url_and_httphdr

Conversation

@hnakamur

Copy link
Copy Markdown
Contributor

No description provided.

hnakamur added 30 commits May 13, 2025 20:29
@bryancall bryancall added this to the 10.2.0 milestone May 16, 2025
@bryancall

Copy link
Copy Markdown
Contributor

[approve ci]

@bryancall bryancall self-requested a review May 19, 2025 22:14
@hnakamur

Copy link
Copy Markdown
Contributor Author

merged master and resolved conflicts.

@hnakamur

Copy link
Copy Markdown
Contributor Author

AuTest 1of4 failed with the following output.

   Run: ipallow-56 @action=add_deny  @method=GET  
   ip_allow:
     - apply: in
       ip_addrs: [0/0, ::/0]
       action: deny
       methods: [GET, POST]
   : Failed
     Starting TestRun 184-tr : Waiting for Process "ts-181" to become ready - Failed

However all autest test cases passed on my local machine.

@hnakamur hnakamur force-pushed the use_string_view_in_url_and_httphdr branch from e8fcda9 to c32024e Compare May 29, 2025 13:38
bryancall
bryancall previously approved these changes Jun 17, 2025
@bryancall

Copy link
Copy Markdown
Contributor

[approve ci]

@bryancall

Copy link
Copy Markdown
Contributor

Rerunning CI before I merge the PR.

@bryancall

Copy link
Copy Markdown
Contributor

@hnakamur it looks like there are a couple minor errors from the recent CI build. I have reviewed the code and it looks good besides these new issues:

In file included from ../src/iocore/cache/CacheEvacuateDocVC.cc:33:
../src/iocore/cache/P_CacheInternal.h:515:33: error: too many arguments to function call, expected 0, have 1
  key->hostname = url->host_get(&key->hostlen);
                  ~~~~~~~~~~~~~ ^~~~~~~~~~~~~
../include/proxy/hdrs/URL.h:571:6: note: 'host_get' declared here
URL::host_get() const noexcept
     ^
In file included from ../src/iocore/cache/CacheEvacuateDocVC.cc:33:
../src/iocore/cache/P_CacheInternal.h:515:19: error: assigning to 'const char *' from incompatible type 'std::string_view' (aka 'basic_string_view<char>')
  key->hostname = url->host_get(&key->hostlen);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
../src/iocore/cache/P_CacheInternal.h:515:33: error: too many arguments to function call, expected 0, have 1
  key->hostname = url->host_get(&key->hostlen);
                  ~~~~~~~~~~~~~ ^~~~~~~~~~~~~
../include/proxy/hdrs/URL.h:571:6: note: 'host_get' declared here
URL::host_get() const noexcept
     ^
In file included from ../src/iocore/cache/CacheDir.cc:27:
../src/iocore/cache/P_CacheInternal.h:515:19: error: assigning to 'const char *' from incompatible type 'std::string_view' (aka 'basic_string_view<char>')
  key->hostname = url->host_get(&key->hostlen);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
../src/iocore/cache/P_CacheInternal.h:515:33: error: too many arguments to function call, expected 0, have 1
  key->hostname = url->host_get(&key->hostlen);
                  ~~~~~~~~~~~~~ ^~~~~~~~~~~~~
../include/proxy/hdrs/URL.h:571:6: note: 'host_get' declared here
URL::host_get() const noexcept
     ^
In file included from ../src/iocore/cache/CacheHttp.cc:25:
../src/iocore/cache/P_CacheInternal.h:515:19: error: assigning to 'const char *' from incompatible type 'std::string_view' (aka 'basic_string_view<char>')
  key->hostname = url->host_get(&key->hostlen);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

@hnakamur

Copy link
Copy Markdown
Contributor Author

I successfully compiled commit c32024e on my Ubuntu PC.

However, the CI environment is encountering a compilation error that I haven't been able to resolve:

../src/iocore/cache/P_CacheInternal.h:515:33: error: too many arguments to function call, expected 0, have 1

I've noticed a discrepancy: the error message refers to line 515 of P_CacheInternal.h, but the linked commit (c32024e) only has 507 lines in that file.

@hnakamur

Copy link
Copy Markdown
Contributor Author

I merged the current master and I am able to reproduce the compile errors now.
I'm going to resolve the errors.

@bryancall

Copy link
Copy Markdown
Contributor

[approve ci]

@bryancall bryancall merged commit 1890ee0 into apache:master Jun 18, 2025
15 checks passed
@hnakamur hnakamur deleted the use_string_view_in_url_and_httphdr branch June 20, 2025 22:21
bneradt added a commit to bneradt/trafficserver that referenced this pull request Nov 4, 2025
The ternary operator was checking literal 80 instead of
request_port == 80, making an accidental tautology that always returned
the HTTP scheme. This was introduced in the apache#12243 URL std::string_view
refactor.
bneradt added a commit that referenced this pull request Nov 4, 2025
The ternary operator was checking literal 80 instead of
request_port == 80, making an accidental tautology that always returned
the HTTP scheme. This was introduced in the #12243 URL std::string_view
refactor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants