brunch / auto-reload-brunch

Adds automatic browser reloading support to brunch.
88 stars 30 forks source link

Fix hang when using SSL and plugin isn't enabled (non-persistent build) #61

Closed kainosnoema closed 8 years ago

kainosnoema commented 8 years ago

If using SSL and the plugin isn't enabled, non-persistent builds hang without exiting because the HTTPS server is never torn down. The fix is to only start the HTTPS server if plugin is enabled (in startServer()).

Also added tests for the expected behavior when providing SSL options.

es128 commented 8 years ago

:+1: Awesome, thanks.

I have a concern for what happens when that cert expires. Can the self-signed cert be generated from within the test instead of checking in this example? Alternately, some instructions should be left somewhere for generating new ones as needed.

kainosnoema commented 8 years ago

@es128 I included the cert because it's difficult to get https.createServer to succeed without a well-formed cert, and stubbing is also quite difficult. I don't believe the cert has to be valid or un-expired—just parseable. I found this one in another public project and AFAIK should work forever.

kainosnoema commented 8 years ago

@es128 it looks like we could use the pem package to create a valid cert on the fly, but it would add a dependency and potentially slow tests down. Happy to try if you'd rather, though. Let me know.

es128 commented 8 years ago

I found this one in another public project and AFAIK should work forever.

Ok, I'm fine with giving it a shot then. If it turns out to be an issue down the road we can deal with it at that point.