Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

combo: support https

  • Loading branch information...
commit 0be1244ca9df4da4d4b9dc776528932262030756 1 parent aeb3b5b
authored
11  TODO
... ...
@@ -1,5 +1,6 @@
1  
-combo,combo-dev
2  
-	support https
  1
+combo: send 404 if not found
  2
+combo-dev: propagate 404 from combo, send 404 if dev version not found
  3
+test deleting module: check for 404
3 4
 
4 5
 
5 6
 npm modules
@@ -32,11 +33,11 @@ auth
32 33
 		(not actually deleted, to avoid re-using name/version)
33 34
 
34 35
 search
35  
-	support "keywords" in description file
36  
-	index description files when start up -- search by module name, keyword, short, long
  36
+	support "tags" in description file
  37
+	index description files when start up -- search by module name, tag, short, long
37 38
 	update index when new modules/bundles are uploaded
38 39
 
39  
-edit namespace/module/bundle descriptions & keywords
  40
+edit namespace/module/bundle descriptions & tags
40 41
 
41 42
 ui for stats:
42 43
 	% of hits that caused re-add
64  combo.js
@@ -56,7 +56,22 @@ var argv = optimist
56 56
 	.option('port',
57 57
 	{
58 58
 		default:  defaults.port || 80,
59  
-		describe: 'Port to listen on'
  59
+		describe: 'Port to listen on for http'
  60
+	})
  61
+	.option('secureport',
  62
+	{
  63
+		default:  defaults.port || 443,
  64
+		describe: 'Port to listen on for https (only used if cert/key are provided)'
  65
+	})
  66
+	.option('key',
  67
+	{
  68
+		default:  defaults.key || '/usr/share/yui3-stockpile/stockpile.key',
  69
+		describe: 'Private key for https'
  70
+	})
  71
+	.option('cert',
  72
+	{
  73
+		default:  defaults.cert || '/usr/share/yui3-stockpile/stockpile.crt',
  74
+		describe: 'Certificate for https'
60 75
 	})
61 76
 	.option('cache',
62 77
 	{
@@ -99,8 +114,6 @@ if (argv.cache)
99 114
 	var cache_key_pending = {};
100 115
 }
101 116
 
102  
-var app = mod_express.createServer();
103  
-
104 117
 var debug_re = /-debug\.js$/;
105 118
 
106 119
 function combo(req, res, query)
@@ -251,26 +264,45 @@ function combo(req, res, query)
251 264
 	}
252 265
 }
253 266
 
254  
-app.get('/combo', function(req, res)
  267
+function configureApp(app)
255 268
 {
256  
-	var query = mod_url.parse(req.url).query;
257  
-	if (!query)
  269
+	app.get('/combo', function(req, res)
258 270
 	{
259  
-		res.end();
260  
-		return;
261  
-	}
  271
+		var query = mod_url.parse(req.url).query;
  272
+		if (!query)
  273
+		{
  274
+			res.end();
  275
+			return;
  276
+		}
262 277
 
263  
-	combo(req, res, mod_qs.unescape(query));
264  
-});
  278
+		combo(req, res, mod_qs.unescape(query));
  279
+	});
265 280
 
266  
-app.get('/*', function(req, res)
267  
-{
268  
-	combo(req, res, req.params[0]);
269  
-});
  281
+	app.get('/*', function(req, res)
  282
+	{
  283
+		combo(req, res, req.params[0]);
  284
+	});
  285
+}
  286
+
  287
+var app = mod_express.createServer();
  288
+configureApp(app);
270 289
 
271  
-Y.log('listening on port ' + argv.port, 'info', 'combo');
  290
+Y.log('listening on http port ' + argv.port, 'info', 'combo');
272 291
 app.listen(argv.port);
273 292
 
  293
+if (mod_path.existsSync(argv.key) && mod_path.existsSync(argv.cert))
  294
+{
  295
+	var sapp = mod_express.createServer(
  296
+	{
  297
+		key:  mod_fs.readFileSync(argv.key, 'utf8'),
  298
+		cert: mod_fs.readFileSync(argv.cert, 'utf8')
  299
+	});
  300
+	configureApp(sapp);
  301
+
  302
+	Y.log('listening on https port ' + argv.secureport, 'info', 'combo');
  303
+	sapp.listen(argv.secureport);
  304
+}
  305
+
274 306
 if (argv.test)
275 307
 {
276 308
 	mod_fs.writeFileSync(argv.test, 'ready', 'utf8');
4  manager.js
@@ -66,12 +66,12 @@ var argv = optimist
66 66
 	})
67 67
 	.option('key',
68 68
 	{
69  
-		default:  defaults.key || '/usr/share/yui3-stockpile/manager.key',
  69
+		default:  defaults.key || '/usr/share/yui3-stockpile/stockpile.key',
70 70
 		describe: 'Private key for https'
71 71
 	})
72 72
 	.option('cert',
73 73
 	{
74  
-		default:  defaults.cert || '/usr/share/yui3-stockpile/manager.crt',
  74
+		default:  defaults.cert || '/usr/share/yui3-stockpile/stockpile.crt',
75 75
 		describe: 'Certificate for https'
76 76
 	})
77 77
 	.option('address',

0 notes on commit 0be1244

Please sign in to comment.
Something went wrong with that request. Please try again.