-
-
Notifications
You must be signed in to change notification settings - Fork 491
Remove trailing colon when parsing the protocol from URL #1778
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
Conversation
I tested it on Windows and #1775 is fixed as expected.
I used Windows_X86-64_zip
in the build artifacts for test.
https://github.com/arduino/arduino-ide/actions/runs/3718811226
I have little experience of typescript. If my code style in this PR is not good, please tell me how to improve it. Thanks.
The code changes look good to me. When I set and use the SOCKS scheme in the Settings
> Network
tab, I get the socks://username:pwd@hostname:port
construct in the arduino-cli.yaml
file.
I noticed the following, however:
Use these settings:
Screen Shot 2022年12月21日 at 10 58 21
IDE2 will send the following config object to the CLI:
{ "board_manager": { "additional_urls": [ "https://arduino.esp8266.com/stable/package_esp8266com_index.json" ] }, "daemon": { "port": "50051" }, "directories": { "data": "/Users/a.kitta/Library/Arduino15", "user": "/Users/a.kitta/Documents/Arduino" }, "library": { "enable_unsafe_install": false }, "locale": "en", "logging": { "file": "", "format": "text", "level": "info" }, "metrics": { "addr": ":9090", "enabled": true }, "output": { "no_color": false }, "sketch": { "always_export_binaries": false }, "updater": { "enable_notification": true }, "network": { "proxy": "http://username:pwd@alma:1234/" } }
The updated CLI config will be this:
board_manager: additional_urls: - https://arduino.esp8266.com/stable/package_esp8266com_index.json daemon: port: "50051" directories: builtin: libraries: /Users/a.kitta/Library/Arduino15/libraries data: /Users/a.kitta/Library/Arduino15 downloads: /Users/a.kitta/Library/Arduino15/staging user: /Users/a.kitta/Documents/Arduino library: enable_unsafe_install: false locale: en logging: file: "" format: text level: info metrics: addr: :9090 enabled: true network: proxy: socks://username:pwd@my_hostname:3636 output: no_color: false sketch: always_export_binaries: false updater: enable_notification: true
When I use the HTTP scheme in the Settings
> Network
tab:
Screen Shot 2022年12月21日 at 11 04 18
The IDE2 will send the following config JSON to the CLI:
{ "board_manager": { "additional_urls": [ "https://arduino.esp8266.com/stable/package_esp8266com_index.json" ] }, "daemon": { "port": "50051" }, "directories": { "data": "/Users/a.kitta/Library/Arduino15", "user": "/Users/a.kitta/Documents/Arduino" }, "library": { "enable_unsafe_install": false }, "locale": "en", "logging": { "file": "", "format": "text", "level": "info" }, "metrics": { "addr": ":9090", "enabled": true }, "network": { "proxy": "http://u:p@host:2345/" }, "output": { "no_color": false }, "sketch": { "always_export_binaries": false }, "updater": { "enable_notification": true } }
But the CLI config YAML will be this:
board_manager: additional_urls: - https://arduino.esp8266.com/stable/package_esp8266com_index.json daemon: port: "50051" directories: builtin: libraries: /Users/a.kitta/Library/Arduino15/libraries data: /Users/a.kitta/Library/Arduino15 downloads: /Users/a.kitta/Library/Arduino15/staging user: /Users/a.kitta/Documents/Arduino library: enable_unsafe_install: false locale: en logging: file: "" format: text level: info metrics: addr: :9090 enabled: true network: proxy: http://u:p@host:2345/ user_agent_ext: daemon output: no_color: false sketch: always_export_binaries: false updater: enable_notification: true
👆 Note the additional network@user_agent_ext: daemon
entry. I could not consistently reproduce it.
I have also noticed when switching from either SOCK or HTTP proxy to no proxy config, the CLI config does not update correctly. The network
prop remains in the YAML.
Have this Settings
> Network
tab:
Screen Shot 2022年12月21日 at 11 09 53
IDE2 sends this CLI config JSON to CLI:
{ "board_manager": { "additional_urls": [ "https://arduino.esp8266.com/stable/package_esp8266com_index.json" ] }, "daemon": { "port": "50051" }, "directories": { "data": "/Users/a.kitta/Library/Arduino15", "user": "/Users/a.kitta/Documents/Arduino" }, "library": { "enable_unsafe_install": false }, "locale": "en", "logging": { "file": "", "format": "text", "level": "info" }, "metrics": { "addr": ":9090", "enabled": true }, "network": {}, "output": { "no_color": false }, "sketch": { "always_export_binaries": false }, "updater": { "enable_notification": true } }
But the CLI YAML will be this:
board_manager: additional_urls: - https://arduino.esp8266.com/stable/package_esp8266com_index.json daemon: port: "50051" directories: builtin: libraries: /Users/a.kitta/Library/Arduino15/libraries data: /Users/a.kitta/Library/Arduino15 downloads: /Users/a.kitta/Library/Arduino15/staging user: /Users/a.kitta/Documents/Arduino library: enable_unsafe_install: false locale: en logging: file: "" format: text level: info metrics: addr: :9090 enabled: true network: proxy: http://uname:korte@hostname:4567/ user_agent_ext: daemon output: no_color: false sketch: always_export_binaries: false updater: enable_notification: true
The network
prop must be missing or empty. It's probably a CLI bug, as IDE2 never writes the config file.
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 have verified the changes and confirm that it fixes #1775. When I configure the socks
protocol in the Settings
> Network
tab, I have the expected socks://username:pwd@hostname:port
construct in the ~/.arduinoIDE/arduino-cli.yaml
file.
Thank you for the help!
IDE2 will send the following config object to the CLI:
FYI: If one starts the IDE2 from the console, the actual CLI config JSON object is dumped when saving the Settings
dialog and updating the CLI config through the daemon.
I guess we need to start a new issue to resolve the problems you find in #1778 (comment)?
FYI: If one starts the IDE2 from the console, the actual CLI config JSON object is dumped when saving the
Settings
dialog and updating the CLI config through the daemon.
It's helpful. Thanks.
I guess we need to start a new issue to resolve the problems you find in #1778 (comment)?
Thanks for your prompt reaction. Yes, we will take care of the follow-ups, and it does not affect this PR. No action is required (unless you want to start working on the other bugs 😉, but they need to be confirmed first.)
I have also noticed when switching from either SOCK or HTTP proxy to no proxy config, the CLI config does not update correctly. The network prop remains in the YAML.
This bug is tracked at arduino/arduino-cli#1677
Motivation
This PR should fix #1775
Change description
Remove the trailing colon when parsing the protocol in URL string
Other information
Reviewer checklist