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

RecorderEndpoint: Parse and use username/password from URLs #44

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

Conversation

j1elo
Copy link
Member

@j1elo j1elo commented Jun 13, 2023

What is the current behavior you want to change?

RecorderEndpoint is not able to push to a basic auth-protected HTTP server, because the GSTreamer element curlhttpsink doesn't parse them from the URL, instead it expects them to be set as properties.

What is the new behavior provided by this change?

Use GstUri to parse the destination URL and extract the username:password field (called "userinfo").

Then, split the userinfo from the colon (:).

Lastly, URL-decode each of the resulting parts.

NOTE: GStreamer 1.16 (Ubuntu 20.04) does NOT support extracting a URL-encoded userinfo field. This means that the username and password will be already decoded, and the splitting on ":" will happen at the first colon found, which won't work if the username itself had a colon.

So, until we update to a newer Ubuntu/GStreamer version:

THE USERNAME CANNOT CONTAIN A COLON.

Also delete the unneeded function kms_is_valid_uri(). Better to delegate that check to the GstUri class constructor, which validates the URI and decides if it is valid or not.

How has this been tested?

Basic auth protected Python http-server.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature / enhancement (non-breaking change which improves the project)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • My change requires a change to the documentation
  • My change requires a change in other repository

Checklist

  • I have read the Contribution Guidelines
  • I have added an explanation of what the changes do and why they should be included
  • I have written new tests for the changes, as applicable, and have successfully run them locally

Resolves #42

Use GstUri to parse the destination URL and extract the
username:password field (called "userinfo").

Then, split the userinfo from the colon (:).

Lastly, URL-decode each of the resulting parts.

NOTE: GStreamer 1.16 (Ubuntu 20.04) does NOT support extracting a
URL-encoded userinfo field. This means that the username and password
will be already decoded, and the splitting on ":" will happen at the
first colon found, which won't work if the username itself had a colon.

So, until we update to a newer Ubuntu/GStreamer version,
THE USERNAME CANNOT CONTAIN A COLON.

Also delete the unneeded function kms_is_valid_uri()`. Better to
delegate that check to the GstUri class constructor, which validates the
URI and ecides if it is valid or not.
@j1elo j1elo self-assigned this Jun 13, 2023
@j1elo j1elo added the enhancement New feature or request label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What is wrong with this URL?
1 participant