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

Support reading system details even the user agent is not fully written #43

Open
samaphp opened this issue Apr 27, 2017 · 5 comments
Open

Comments

@samaphp
Copy link

samaphp commented Apr 27, 2017

Thank you for this amazing function <3

Current version does not support reading details in User-Agent if it is not full detailed.
Example:
User-Agent: AppName/1.0.23 (example.com/AppName; [email protected]).

It just read the AppName with version and does not read the system details.

This case usually used when contacting APIs where everyone should write self-described User-Agent.

Many Thanks

@samaphp
Copy link
Author

samaphp commented Apr 27, 2017

I wrote extra code to support this kind of user-agents on this pull request #44

@donatj
Copy link
Owner

donatj commented Apr 27, 2017

The example you give doesn't appear to contain any system information? Please correct me if I'm misunderstanding.

If system info isn't provided I cannot provide details that are not in the user agent string itself. However if system information is provided ala

AppName/1.0.23 (example.com/AppName; [email protected]; Windows)

It does return AppName version 1.0.23 on Windows as one would expect.

@samaphp
Copy link
Author

samaphp commented Apr 28, 2017

Thank you for this fast response. Depending on Wikipedia this part of User-Agent:

(iPad; U; CPU OS 3_2_1 like Mac OS X; en-us): Details of the system in which the browser is running.
Refer to system and application details.

Also, it's most common when calling APIs that you should set a user-agent for all your requests like this New-Relic example.

and a lot of other API documentations.

So, now when I'm building an API I should take care of this kind of user-agents and read them correctly.

Thanks

@donatj
Copy link
Owner

donatj commented Apr 28, 2017

I made my comment before you submitted your PR. I can absolutely see a desire to get those parts of the UA string. I will need to take some time and experiment with how this applies to things across the board, but I really like the idea of your PR #44

@samaphp
Copy link
Author

samaphp commented Apr 28, 2017

Yes sure, take your time. I already have my own fork with this update.
If you have any notes I will be glad to resubmit my PR and fixing test assertion issue.
Thanks for your time. And thanks again for this amazing function. 🌹

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

3 participants
@donatj @samaphp and others