-
Notifications
You must be signed in to change notification settings - Fork 7.8k
User Agent now reports the OS platform #4937
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
Merged
daxian-dbw
merged 12 commits into
PowerShell:master
from
LDSpits:hotfix/correct-useragent
Oct 6, 2017
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
21d32db
Powershell web useragent now takes the OS into account
LDSpits 5502909
add missing semicolon
LDSpits 7294421
changed code to follow code conventions, using debug.assert to warn o…
LDSpits 91352cb
further code style improvements, renamed property Platform to Platfor…
LDSpits d476ea8
now calling assert from correct class with correct parameters
LDSpits 510039a
windows platform string now includes version numbers
LDSpits 5f3c262
psuseragent now only creates the windows useragent string once
LDSpits 8a99117
[Feature] Added tests for dynamic user-agents
LDSpits 195a018
[Feature] fixed Linux Invoke-RestMethod Useragent test
LDSpits 3d2358f
[Feature] Adressed feedback
LDSpits c1d6769
[Feature] Possible fix for problem with user-agent on mac
LDSpits 56b71af
[Feature] reverted to previous version because of unreliable testrun
LDSpits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add tests for these. These could either be a separate test or the existing 'User-Agent` tests could be expanded.
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Line 456 in b07f24e
PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
Line 1308 in b07f24e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should be patform sensetive - I'd prefer new separate test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iSazonov I agree.
@LDSpits you can use these tests as a base. Please include tests for both
Invoke-WebRequest
andInvoke-RestMethod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright, will start work on them later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LDSpits Also, it looks like the Windows platform part is supposed to include the
<major>.<minor>
version of windows (6.1, 10.0, etc.). I wouldn't call this a requirement, but if you could add that too it would be great!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iSazonov I actually personally like parsing
[RuntimeInformation]::OSDescription
. The parsing is a one-time effort and pretty easy. I know you might concern about the consistency of the string value returned from this property ... :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Ex. - What about Unix? I wouldn't trust
OSDescription
. I'd prefer to discuss all our User-Agent string (properties) before enhance this one.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need the version info for Linux. This is what I got when using chrome to send request to
http://httpbin.org/user-agent
:Windows: (Windows NT 10.0; Win64; x64)
Ubuntu: (X11; Linux x86_64)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see FireFox. Specially MacOS and Android.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daxian-dbw is correct. The OS version numbers in the platform are only sent for Windows platforms. Linux platforms send either
X11
orLinux
(Linux
is used more in CLI based HTTP agents). macOS sendsMachintosh
. None of those with versions.