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

url stdlib module #2181

Open
mfelsche opened this issue Jan 17, 2023 · 6 comments
Open

url stdlib module #2181

mfelsche opened this issue Jan 17, 2023 · 6 comments
Assignees
Labels
_complexity:low A task with a low complexity that should be easy to understand enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mfelsche
Copy link
Member

Describe the problem you are trying to solve

Parsing urls as strings is hard, manipulating and evaluating them is even harder, although it doesn't have to be.

Describe the solution you'd like

We would like to have a stdlib module for tremor-script that makes it possible to parse a url structure from a string and construct a url from parts and modify existing urls.

Those functions would be implemented in the existing std::url module:

Example script (just my imagination going wild, could be implemented totally differently):

use std;
let url_str = "https://example.org/path?query=foo&snot&badger=1&badger=2#fragment";
let url = std::url::parse(url_str);
url.scheme == "https";
url.host == "example.org";
url.path = "/path";
url.query = "query=foo&snot&badger=1&badger=2";
url.fragment = "fragment";
let query = std::url::parse_query(url.query);
# ...
@mfelsche mfelsche added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers _complexity:low A task with a low complexity that should be easy to understand labels Jan 17, 2023
@glokta1
Copy link

glokta1 commented Jan 24, 2023

Hey, I'd like to take a stab at this :D

@mfelsche
Copy link
Member Author

Cool, shall I assign you to this issue?

Do you need any guidance? Please check those links above first and see if they are helpful for you.

Here is an example on how to conduct tests on your implementations: https://github.com/tremor-rs/tremor-runtime/blob/main/tremor-cli/tests/stdlib/std/all.tremor#L630-L643

@glokta1
Copy link

glokta1 commented Jan 26, 2023

Hey @mfelsche , sorry I'm a little stretched thin right now, which I didn't anticipate when I commented on this issue 😅. I won't be able to work on this for the time. Feel free to assign it to my good friend @0xquark. He says he can work on this.

@mfelsche
Copy link
Member Author

Thank you for your transparency here @glokta1 . Lets have a thumbs up from @0xquark on this comment and the assignment will happen :)

@0xquark
Copy link
Contributor

0xquark commented Jan 28, 2023

Thanks @glokta1 for follow-up. This issues seems something i can work on as i am still learning rust and this would help me understand things in a much better way, @mfelsche let's make this fix happen!

@Licenser
Copy link
Member

Awesome, the rust part isn't too tough on this, the steps to take is:

  1. find a library that does the encoding (the URL one we already use will likely be a good starting point ;) )
  2. build the datastructures
  3. export & expose the function (Matthias already linked the relevant files)
  4. win :)

If you get stuck at any point feel free to ping or drop a message in the discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
_complexity:low A task with a low complexity that should be easy to understand enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants