Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong uri format in location header #144

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

Alonza0314
Copy link
Contributor

This PR fix the problem in issue #71.

Before:
Screenshot 2025-01-14 at 12 07 19 AM

After:
Screenshot 2025-01-14 at 7 26 24 PM

@andy89923
Copy link
Contributor

Hi @Alonza0314 ,

From #71 ,

he other free5GC components are aware of that and build the correct URI themselfs

Do we need to change the other NF's code?

@Alonza0314
Copy link
Contributor Author

Hi @Alonza0314 ,

From #71 ,

he other free5GC components are aware of that and build the correct URI themselfs

Do we need to change the other NF's code?

Yes, I have told amf to modify in r17.👍

@Alonza0314 Alonza0314 force-pushed the fix/api-smcontext-reply-hdr-location-format branch from 6d1c92b to 3b8b2b4 Compare January 15, 2025 12:12
@Alonza0314 Alonza0314 changed the base branch from main to next January 15, 2025 12:13
@Alonza0314 Alonza0314 force-pushed the fix/api-smcontext-reply-hdr-location-format branch from 3b8b2b4 to a1d09e2 Compare January 15, 2025 12:29
@ianchen0119
Copy link
Contributor

@Alonza0314

LGTM.
I will merge the PR once AMF's patch is ready to be merged.

protocol,
c.Request.Host,
strings.TrimSuffix(c.Request.URL.Path, "/"),
strings.Split(smContext.Ref, ":")[2])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add the length check to avoid the invalid memory access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check appears to be redundant for two reasons:

  1. During UUID creation, the Must() function already ensures its validity by panicking if the creation fails.
  2. In the formatting part, the code:
copy(buf[:], "urn:uuid:")
encodeHex(buf[9:], uuid)

guarantees that the format will always be urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

Therefore, an additional length check at here is unnecessary as the format is enforced by the implementation itself.

By the way, I still can add a double check at here. Do you think we need it?😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants