Permalink
Browse files

[api]Code fixes - naming, missing var

  • Loading branch information...
1 parent c9faafe commit ce07cc34216b31184d7e4ec0822a0ee082566d49 @pkrefta pkrefta committed Jul 2, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/core.js
View
@@ -55,27 +55,31 @@ core.createServer = function (options) {
//
if (options.https || options.spdy) {
- var key;
+ if(options.https && options.spdy){
+ throw new Error('You shouldn\'t be using https and spdy simultaneously.')
+ }
+
+ var key, serverOptions, credentials;
if(options.spdy) {
key = 'spdy';
} else {
key = 'https';
}
- server_options = options[key];
+ serverOptions = options[key];
- if (!server_options.key || !server_options.cert) {
+ if (!serverOptions.key || !serverOptions.cert) {
throw new Error('Both options.'+key+'.`key` and options.'+key+'.`cert` are required.');
}
credentials = {
- key: fs.readFileSync(server_options.key),
- cert: fs.readFileSync(server_options.cert)
+ key: fs.readFileSync(serverOptions.key),
+ cert: fs.readFileSync(serverOptions.cert)
};
- if (server_options.ca) {
- credentials.ca = fs.readFileSync(server_options.ca);
+ if (serverOptions.ca) {
+ credentials.ca = fs.readFileSync(serverOptions.ca);
}
if(options.spdy){

0 comments on commit ce07cc3

Please sign in to comment.