Skip to content

Downloader helper user agent #227

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
merged 41 commits into from
Jun 13, 2019
Merged

Downloader helper user agent #227

merged 41 commits into from
Jun 13, 2019

Conversation

rsora
Copy link
Contributor

@rsora rsora commented Jun 5, 2019

(Following PR #226)
This PR adds to the DownloadResource.Download() method the missing configuration setting in order to specify the correct User-Agent when contacting Arduino web-services via http/https

i.e.
User-Agent: arduino-cli/0.3.6-alpha.preview (amd64; linux; go1.10) Commit:deadbeef1010/Build:2019-06-05 23:12:33.1234

in addition, proper testing to check header sent to backend service is provided in helpers_test.go

@rsora rsora requested review from cmaglie and Rocketct June 5, 2019 20:12
@rsora rsora force-pushed the downloader-helper-user-agent branch 4 times, most recently from 80eda15 to cc65201 Compare June 11, 2019 08:46
Roberto Sora added 24 commits June 11, 2019 11:05
…eaders build from VersionInfo struct in cli InitInstance func
@rsora rsora force-pushed the downloader-helper-user-agent branch from cc65201 to e2586ca Compare June 11, 2019 10:46
@rsora rsora requested a review from masci June 11, 2019 15:49
@rsora rsora removed the request for review from Rocketct June 13, 2019 08:18
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Maybe there is a chance to reduce arguments by putting http.Header into Instance. This may be considered for a future API expansion.

@cmaglie cmaglie added this to the next alpha milestone Jun 13, 2019
@rsora rsora merged commit 6b9d8e5 into master Jun 13, 2019
@rsora rsora deleted the downloader-helper-user-agent branch June 13, 2019 09:42
@rsora rsora mentioned this pull request Jun 13, 2019
mastrolinux pushed a commit that referenced this pull request Jul 16, 2019
* add global variables and Info struct in order to inject build time values via ldflags

* replace cli.AppName with global variable global.GetAppName() getter

* replaced cli.Version var with global getter

* add .idea to .gitignore

* re organize imports

* add license to global.go

* add hardcoded fallback version string

* organize imports step2

* organize imports step3

* replace cli.AppName with global variable global.GetAppName() getter

* add User-Agent header to downloader helper configuration

* add testing for user agent-string generation

* re organize imports

* refactor global package into version package and rename and replace having cli login,logout,validate removed

* refactor versioning variables in version package and implement Info struct wihth String method

* refactor Info cosntructor to use directly package vars and renamed package from global to version

* replace package name from global to version

* solve package name clash for version and cli/version

* replace application name getter with VersionInfo.Application field
having removed cli login,logout,validate

* search and replace version string getter with VersionInfo.VersionString field

* implement empty http.Header struct propagation from cli to resources

* align downloader helper to use propagated http.Header from upper layers and modify test accordingly

* align daemon to use empty http.Header as struct field in ArduinoCoreServerImpl

* clean inside cobra commands for empty http.Header struct and inject headers build from VersionInfo struct in cli InitInstance func

* remove unused runDaemonCommand in daemon

* add user agent specific for daemon mode via DownloaderHeaders property for ArduinoCoreServerImpl

* add testing information in README.md

* removed getters and related usage for version package

* update dependencies

* finalize helpers_test User-Agent header value

* add integration test for version info injection via vars

* tidy go mod and reorganize imports and tidy long lines

* inject ldflags variables in build task in Taskfile.yml

* replace commands in /travis.yml with tasks properly merging flags

* fix install command for go-task to solve "undefined: interp.EnvFromList" error

* add coverage files to .gitignore

* tidy dependencies in go.mod

* update task executable path in tasks due to install path generated by go-task install script

* implement exported variable cli.HTTPClientHeader in order to have it available in all cli subpackages and not onli in cli

* fix comment replacing "version config" with "global config"

* leverage cli.VersionInfo to present a better terminal and json data for version info
per1234 added a commit that referenced this pull request Aug 9, 2021
Sync test assets workflow with templates
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.

3 participants