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

Allow for hidden port 80 #128

Merged
merged 1 commit into from
Jul 20, 2017
Merged

Allow for hidden port 80 #128

merged 1 commit into from
Jul 20, 2017

Conversation

superhawk610
Copy link
Contributor

Should fix #126. @Yamboy1 had the correct regex to append 80 if the browser didn't supply it, but reload.js also needed to be updated to correctly replace the new structure.

@ghost ghost mentioned this pull request Jul 12, 2017
@@ -1,6 +1,10 @@
(function refresh () {
var verboseLogging = false
var socketUrl = window.location.origin.replace() // This is dynamically populated by the reload.js file before it is sent to the browser
var socketUrl = window.location.origin
if (!window.location.origin.match(/:[0-9]+/)) {
Copy link
Owner

Choose a reason for hiding this comment

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

We probably want account for port 443 too I'm thinking?

And I'd like this all in a series of if statements.

I'm thinking

if (!window.location.origin.match(/:[0-9]+/)) {

}
else if (https regex for port 443) {

}
else {
  socketUrl = socketUrl.replace() // This is dynamically populated by the reload.js file before it is sent to the browser
}

What are your thoughts on this?

Copy link

Choose a reason for hiding this comment

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

Why does it need to change for port 443?

Copy link
Owner

Choose a reason for hiding this comment

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

Because 443 is also an anonymous port when running https. Might not be relevant though for the command line program?

Copy link

Choose a reason for hiding this comment

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

Seems like a good idea. I'll look into it.

Copy link

Choose a reason for hiding this comment

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

I've made a pull request #129 that does this and has been tested.

Copy link
Owner

Choose a reason for hiding this comment

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

I think this block of code would be safe if it was like:

if (!window.location.origin.match(/:[0-9]+/)) {
  socketUrl = window.location.origin + ':80'
}
else {
  socketUrl = socketUrl.replace() // This is dynamically populated by the reload.js file before it is sent to the browser
}

@alallier
Copy link
Owner

alallier commented Jul 12, 2017

Other than above comment is working great

@alallier alallier mentioned this pull request Jul 12, 2017
@ghost ghost mentioned this pull request Jul 13, 2017
@alallier
Copy link
Owner

This looks great, thank you for the quick reporting and subsequent PR!!

@alallier alallier merged commit 3aabaa9 into alallier:master Jul 20, 2017
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.

reload-client.js via /reload/reload.js fails when Node server is listening on port 80
2 participants