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

easier ability to read all headers #16

Closed
GlenDC opened this issue Jan 27, 2024 · 4 comments
Closed

easier ability to read all headers #16

GlenDC opened this issue Jan 27, 2024 · 4 comments

Comments

@GlenDC
Copy link
Contributor

GlenDC commented Jan 27, 2024

Currently only content-type header is read. That said, this library has made it a lot easier for me to integrate libcurl into my project so thanks a lot for your efforts.

That said, if it fits within the scope of your project, would probably be useful if one can access all headers from a response. For now this is how I've done it:

  1. enable show_headers(true)
  2. search in the bytes of the body (payload) for the response (e.g. making sure to skip the proxy CONNECT headers if these are also there)
  3. use httparse to parse the response

And as such I have access to all headers.

This is however pretty fragile and works only because I am for now only using it on one website and only for HTTP/1.1

What do you think. In the Easy client there is a way to enable a callback to get all headers. Easy2 doesn't seem to have this.
Does supporting this fit within your project or is this out of scope?

Either way, thanks a lot!

@LorenzoLeonardo
Copy link
Owner

This crate would only use Easy2 since it is easier to handle when implementing async operations than Easy. I am open for a pull request to improve this crate. I am still learning about https://github.com/alexcrichton/curl-rust. We can ask them if they can add it for Easy2.

@LorenzoLeonardo
Copy link
Owner

LorenzoLeonardo commented Jan 27, 2024

We could also ask the creators of curl-rust to have an interface to get all header responses. As of the moment, it seems we can only access it one by one.

@GlenDC
Copy link
Contributor Author

GlenDC commented Jan 27, 2024

Ok. Added a issue for starting a discussion there: alexcrichton/curl-rust#544

@GlenDC
Copy link
Contributor Author

GlenDC commented Jan 28, 2024

Closing this issue as is. Seems I can just implement my own collector and then all is good, as explained here: alexcrichton/curl-rust#544 (comment)

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

No branches or pull requests

2 participants