11'use strict' ;
22
3- const path = require ( 'path' ) ;
43const url = require ( 'url' ) ;
5- const fs = require ( 'graceful-fs' ) ;
64const ipaddr = require ( 'ipaddr.js' ) ;
75const internalIp = require ( 'internal-ip' ) ;
86const killable = require ( 'killable' ) ;
@@ -41,7 +39,7 @@ class Server {
4139 // this value of ws can be overwritten for tests
4240 this . wsHeartbeatInterval = 30000 ;
4341
44- normalizeOptions ( this . compiler , this . options ) ;
42+ normalizeOptions ( this . compiler , this . options , this . logger ) ;
4543
4644 this . applyDevServerPlugin ( ) ;
4745
@@ -63,7 +61,6 @@ class Server {
6361
6462 this . setupWatchFiles ( ) ;
6563 this . setupFeatures ( ) ;
66- this . setupHttps ( ) ;
6764 this . createServer ( ) ;
6865
6966 killable ( this . server ) ;
@@ -505,51 +502,6 @@ class Server {
505502 } ) ;
506503 }
507504
508- setupHttps ( ) {
509- // if the user enables http2, we can safely enable https
510- if (
511- ( this . options . http2 && ! this . options . https ) ||
512- this . options . https === true
513- ) {
514- this . options . https = {
515- requestCert : false ,
516- } ;
517- }
518-
519- if ( this . options . https ) {
520- const getCertificate = require ( './utils/getCertificate' ) ;
521-
522- for ( const property of [ 'cacert' , 'pfx' , 'key' , 'cert' ] ) {
523- const value = this . options . https [ property ] ;
524- const isBuffer = value instanceof Buffer ;
525-
526- if ( value && ! isBuffer ) {
527- let stats = null ;
528-
529- try {
530- stats = fs . lstatSync ( fs . realpathSync ( value ) ) . isFile ( ) ;
531- } catch ( error ) {
532- // ignore error
533- }
534-
535- // It is file
536- this . options . https [ property ] = stats
537- ? fs . readFileSync ( path . resolve ( value ) )
538- : value ;
539- }
540- }
541-
542- let fakeCert ;
543-
544- if ( ! this . options . https . key || ! this . options . https . cert ) {
545- fakeCert = getCertificate ( this . logger ) ;
546- }
547-
548- this . options . https . key = this . options . https . key || fakeCert ;
549- this . options . https . cert = this . options . https . cert || fakeCert ;
550- }
551- }
552-
553505 createServer ( ) {
554506 const https = require ( 'https' ) ;
555507 const http = require ( 'http' ) ;
0 commit comments