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

Move set above rewrite to fix uninitialized variable #5211

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

AlexFenlon
Copy link
Contributor

Proposed changes

Moved set default_connection_header above rewrites to fix a warning in the logs about that variable being uninitialized.

I did extensive testing before making this change to make sure this won't affect anyone. Using my own web socket app and the examples/custom-resources/traffic-splitting/cafe-virtual-server.yaml in the issue to test what changes are made if I moved this set before the rewrites.

Doing a websocket connecton via npx wscat -c ws://cafe.example.com:80 does not give a warning which means it's only curl giving the warning

Curl hasn't recognised websockets due to curl being designed for standard http only and therefore gives the warning as http_upgrade is blank doing a curl and not using websockets as websockets automatically sets the upgrade and connection headers. That is why there is a warning.

Doing the websocket connection defines the http_upgrade which then maps the default_connection_header so therefore it is defined and initialised so it doesn't give the warning.

This curl command doesn't give a warning before and after moving the set so therefore everything will work as normal, this change will just mask the warning
curl --include \ --header "Connection: Upgrade" \ --header "Upgrade: websocket" \ http://cafe.example.com:80/

Resolves: #5082

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@AlexFenlon AlexFenlon requested a review from a team as a code owner March 7, 2024 13:14
@github-actions github-actions bot added the bug An issue reporting a potential bug label Mar 7, 2024
Copy link
Collaborator

@pdabelf5 pdabelf5 left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@jjngx jjngx left a comment

Choose a reason for hiding this comment

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

🚀

@AlexFenlon AlexFenlon self-assigned this Mar 7, 2024
@AlexFenlon AlexFenlon merged commit f203f78 into main Mar 7, 2024
77 checks passed
@AlexFenlon AlexFenlon deleted the fix/uninitialized-variable branch March 7, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue reporting a potential bug
Projects
Archived in project
4 participants