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

HTTP client: Automatically follow redirects #35

Open
Tectu opened this issue Jul 1, 2021 · 7 comments
Open

HTTP client: Automatically follow redirects #35

Tectu opened this issue Jul 1, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@Tectu
Copy link
Owner

Tectu commented Jul 1, 2021

The HTTP client should provide a setting that allows the user to control whether redirects are followed automatically.
Currently, redirects are not followed automatically.

I'm considering adding this for the initial v0.1 release.

@Tectu Tectu added the enhancement New feature or request label Jul 1, 2021
@Tectu Tectu added this to the v0.1 milestone Jul 6, 2021
@Tectu Tectu self-assigned this Jul 7, 2021
@Tectu
Copy link
Owner Author

Tectu commented Jul 7, 2021

@0x00002a do you see any scenario that would justify implementing this in a way that a user can inspect whether one or more redirects were followed or should this just happen completely transparent to the user?

One such use case I'd see is when implementing something like a RestAPI testing tool (eg. something like Postman or Insomnia). However, with an application that requires such a level of control a developer is likely to implement redirect following as a custom feature anyway, eg. to compile a timeline.

Thoughts?

@0x00002a
Copy link
Contributor

0x00002a commented Jul 8, 2021

iirc curl does not provide any way of checking whether redirects were followed, it just provides the FOLLOW_LOCATION option. My main use case for malloy client-side is replacing C style curl code. Like you said, theres nothing stopping the user from inspecting the response's result, finding its a redirect and doing the logic themselves if they want that level of control

@Tectu
Copy link
Owner Author

Tectu commented Jul 10, 2021

@0x00002a how busy are you currently? I'd really like to move to the first release ASAP to make maintaining applications consuming this library easier and hopefully also attracting more users & contributors.

Do you feel like giving this a go?

@Tectu Tectu removed their assignment Jul 10, 2021
@0x00002a
Copy link
Contributor

0x00002a commented Jul 11, 2021

This is proving non-trivial. In the case of http redirects that go to a different host, we are going to have to parse the url provided to actually get that host so we can pass it to the resolver. I'm not sure if I should try writing code to do this, since anything I do write is going to be quite naive and certainly not cover all cases. I can implement this partially (without support for redirects to a different host) though.

Really I think malloy might need to depend on a url library for this sort of thing.

Thoughts?

@Tectu
Copy link
Owner Author

Tectu commented Jul 12, 2021

Yeah, I have been looking at this for a while now. It didn't even have an alpha release when I started writing this library. That's why I added my own quick'n'dirty uri class (remember that one, eh?).

Do you know of any decent alternatives?

@0x00002a
Copy link
Contributor

0x00002a commented Jul 12, 2021

None that I've used. I too like the look of Boost.URL, but as far as I can tell it is in no way ready for use yet. this (github repo) looks pretty nice and is something I was investigating for my own code, but I haven't actually used it.

@Tectu
Copy link
Owner Author

Tectu commented Jul 13, 2021

I think we should aim for not including this in the initial v0.1 release given the complexity / nature of intrusive changes if we implement it properly.

@Tectu Tectu removed this from the v0.1 milestone Jul 13, 2021
@Tectu Tectu mentioned this issue Jan 7, 2022
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

No branches or pull requests

2 participants