Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

A single http.createServer([options], [listener]) interface for http/s #8670

Closed
hueniverse opened this issue Nov 4, 2014 · 6 comments
Closed

Comments

@hueniverse
Copy link

Here's a silly question: why do we have to require different submodules and call the same method with slightly different arguments when we can easily merge the two into a single call? Every place where http/https is an option, we repeat the same silliness of checking for TLS options and based on that requiring a different agent, etc.

Can we just enhance http.createServer() to accept options, and if those options include tls, to return the right server? This will be fully backwards compatible, but will make for much cleaner code elsewhere.

@indutny
Copy link
Member

indutny commented Nov 4, 2014

Well, the thing is that https server technically won't work without the options object, while http don't really need any. I don't mind adding an argument to http.Server though.

@hueniverse
Copy link
Author

The point is that http can just do the work for me without having to grab https directly.

@rlidwka
Copy link

rlidwka commented Nov 4, 2014

I have the same question about http.request/https.request

@Fishrock123
Copy link

Yeah, I think this makes sense.

After all, both are HTTP, just running on different network protocols. These should be abstracted away when possible, imo.

👍

@natewatson999
Copy link

I have published a module that allows http and https to be run on the same server. Perhaps this solves the issue of this bug. https://github.com/natewatson999/httpx/tree/master

@natewatson999
Copy link

Given that a working module to deal with this issue has been published, I think this issue should be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants