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

Added Debug tracing and response->raw_headers #17

Closed
wants to merge 4 commits into from

Conversation

larrykluger
Copy link

Hi,

I added two features, thank you for considering them for integration.

More info below.

Regards,
Larry Kluger

Debug Tracing

When working with a new protocol, sometimes you need to see exactly what is being sent and received "on the wire." This type of "peeking" is a common development tool for network protocols. Debug trace is enabled when he calling program defines a constant UNIREST_TRACE. See the bottom of the updated Readme.

response->raw_headers

As I developed my app, which is implementing OAuth with SharePoint Online, I found that the existing response->headers was not sufficient since Microsoft returns two headers with the same key (the same name). Since response->headers is a hash, the second instance of the header was overwriting the first one. There was no way for me to access the first value of the header. So I added the raw_headers property.

It turns out that having multiple headers with the same name is legal. See the HTTP specification: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 But is certainly unusual. I think adding raw_headers is a light-weight way to enable people to deal with this corner-case.

Use raw_headers for special case of duplicate header name in the
response. -- SharePoint Online does this, sigh.
@ahmadnassri
Copy link
Contributor

hey @larrykluger we just released v2.0.0 with some major re-factoring and added functionality.

would love to have this PR updated to match the new code structure!

thanks.

@larrykluger
Copy link
Author

Hi Ahmad, @ahmadnassri

If I have time, I will update the PR.

Next time you may want to respond to PRs a little faster than 17 months later! But, I understand that we're all busy folks :)

Anyhow, thank you for your time on the Unirest project.
Regards,
Larry

@ahmadnassri
Copy link
Contributor

thanks @larrykluger and yes, I do apologize. this project has been somewhat abanodened for a while, and is now going to get the full attention it deserves!

thanks for your help and support!

@ahmadnassri ahmadnassri closed this Dec 1, 2015
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.

None yet

2 participants