소스 검색

#29 Add test server support for SSL request

Ben Hsieh 8 년 전
부모
커밋
b5654ccb46
4개의 변경된 파일53개의 추가작업 그리고 0개의 파일을 삭제
  1. 12
    0
      test-server/cert.csr
  2. 15
    0
      test-server/cert.pem
  3. 15
    0
      test-server/key.pem
  4. 11
    0
      test-server/server.js

+ 12
- 0
test-server/cert.csr 파일 보기

@@ -0,0 +1,12 @@
1
+-----BEGIN CERTIFICATE REQUEST-----
2
+MIIBzTCCATYCAQAwdzELMAkGA1UEBhMCVFcxDTALBgNVBAgTBG5vbmUxCzAJBgNV
3
+BAcTAmtoMQ0wCwYDVQQKEwRub25lMQ0wCwYDVQQLEwRub25lMQ0wCwYDVQQDEwRu
4
+b25lMR8wHQYJKoZIhvcNAQkBFhB4ZWl5YW5AZ21haWwuY29tMIGfMA0GCSqGSIb3
5
+DQEBAQUAA4GNADCBiQKBgQClOQ2L0cePrFvKv6N8wwIWhzcSpH0Pt4pMEovDxCah
6
+8if4BuiXrhHwD7Dwa0IQZ7H7D2ELNvNa1rPuhEnQTrQrxLflvidaG6Wi+Y4pOQmJ
7
+Za8LfyARQoMfvk0gX53mFhVpO25sXk0GboqJeUzdTgtpWt0DFxHlJSX6EdjtSaUU
8
+FwIDAQABoBYwFAYJKoZIhvcNAQkHMQcTBTEyMzQ1MA0GCSqGSIb3DQEBBQUAA4GB
9
+AJPbcZWigVJ/WySwx3Irt1ELm3iF1KbWV2WioQpPwNCxqxgDaqG2cApiK7ZAbHXi
10
+pn7CDldZX/lDJ3YRUaUr1isVwAHRfvPCtiw4IP2auyhR5PppThMmdNZ0NhqUIGrt
11
+PNxD9dz8nos0bLu9pKHrh6ddkII7aSdKNAffKpOSCw/x
12
+-----END CERTIFICATE REQUEST-----

+ 15
- 0
test-server/cert.pem 파일 보기

@@ -0,0 +1,15 @@
1
+-----BEGIN CERTIFICATE-----
2
+MIICZTCCAc4CCQCwgCmXw0mNVDANBgkqhkiG9w0BAQUFADB3MQswCQYDVQQGEwJU
3
+VzEN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HlJSX6EdjtSaUUFwIDAQAB
5
+AoGACVctXd8xMf0jf1XQL0hzAMUKJwKnk1Dj/6L4xct8B6HCArKZSaHsn66zaRQX
6
+OwgxtqjK6rBjl5oVuAFAjwc0BkIiV2xhisZglrwTBnxlWzVBKreim8fK8/gV0uxU
7
+t04VQHcEg1oZzO+XU1kqVRnb3YdxtyX5+D8WMp7L1ehcoKECQQDY7ok1vTmqinvZ
8
+Hp8kH3pnAA/p0WTGxLAwxoUvL+/d5gzbG+E7zEFK8aEsWdXV/3YbvpgvVDS+8vMA
9
+su9YTF2HAkEAwvqE52x3F/KESogZSciTEFida1f5FTlfqHzLROgl+oNX732QjQnI
10
+19mnhh0XEkVXjWMyMui4aRIW0j1d5zi48QJAUUFoG7z5MKwWn8kciwdPbe1UCJzq
11
+Rpm99Ucm8/ncux1Ei33x69giTNQdLuOneTTrJJFLp86+wxd1djmP9V8FWQJAMVkM
12
+iDIYllQIDYESvWzpY8q51PBIF4oU3uTu4XrMGfJiMDgcfMXMMm1hC/2S2En6lctU
13
+ajQicF1mr0Fe4eWmUQJBAMDeyobCzvPZFn+UQbNdPCPYwa+HfJN1fd7UOZYRLmiW
14
+6e/2wX6jHVVIRftG2Nj2o7e7x5xHat+w+qEiBRXwtOc=
15
+-----END RSA PRIVATE KEY-----

+ 11
- 0
test-server/server.js 파일 보기

@@ -13,6 +13,7 @@ var mkdirp = require('mkdirp')
13 13
 var dirname = require('path').dirname
14 14
 var app = express()
15 15
 var fs = require('fs')
16
+var https = require('https')
16 17
 
17 18
 var JS_SOURCE_PATH = '../test/',
18 19
     LIB_SOURCE_PATH = '../src/',
@@ -24,6 +25,16 @@ watch(JS_SOURCE_PATH, APP_SOURCE_PATH)
24 25
 // watch lib js source
25 26
 watch(LIB_SOURCE_PATH, NODE_MODULE_MODULE_PATH, {ignored: /\.\.\/src\/(android|ios)\//})
26 27
 
28
+// https
29
+var server = https.createServer({
30
+  key : fs.readFileSync('./key.pem'),
31
+  cert : fs.readFileSync('./cert.pem')
32
+}, app).listen(8124, function(err){
33
+  if(!err)
34
+    console.log('SSL test server running at port ',8124)
35
+})
36
+
37
+// http
27 38
 app.listen(8123, function(err){
28 39
   if(!err)
29 40
     console.log('test server running at port ',8123)