node-http-server – Diff between revs 29 and 30
?pathlinks?
Rev 29 | Rev 30 | |||
---|---|---|---|---|
Line 92... | Line 92... | |||
92 | |
92 | |
|
93 | // Start HTTP server. |
93 | // Start HTTP server. |
|
94 | http.createServer( |
94 | http.createServer( |
|
95 | // authentication, |
95 | // authentication, |
|
96 | (request, response) => |
96 | (request, response) => |
|
97 | handler.process(config, request, response, root, (result) => { |
97 | handler.process(config, request, response, root, (logging, result) => { |
|
98 | |
98 | |
|
99 | // Log the message by severity. |
99 | // Log the message by severity. |
|
100 | log.log(result.severity, result.message); |
- | ||
101 | if(result.status) |
- | ||
102 | response.status = result.status; |
100 | log.log(logging.severity, logging.message); |
|
103 | |
- | ||
104 | // If no data stream is made available or the content type is not |
101 | |
|
105 | // set then there is no further reason to bother with the request. |
- | ||
106 | if(typeof result.data === 'undefined' || result.data === null || |
102 | // If no result is to be processed, then terminate the request. |
|
107 | typeof result.type === 'undefined' || result.type === null) |
103 | if (typeof result === 'undefined' || result === null) |
|
108 | return; |
104 | return; |
|
- | 105 | |
||
- | 106 | // Set the response status. |
||
109 | |
107 | response.status = result.status; |
|
110 | // Set the content type and send the data. |
108 | // Set the content type and send the data. |
|
111 | response.setHeader('Content-Type', result.type); |
109 | response.setHeader('Content-Type', result.type); |
|
112 | result.data |
110 | result.data |
|
113 | .on('open', () => result.data.pipe(response)); |
- | ||
- | 111 | .on('readable', () => result.data.pipe(response)) |
||
114 | |
112 | .on('end', () => response.end()); |
|
115 | }) |
113 | }) |
|
116 | ).listen(config.net.port, config.net.address, () => { |
114 | ).listen(config.net.port, config.net.address, () => { |
|
117 | log.info('HTTP Server accessible at: http://' + |
115 | log.info('HTTP Server accessible at: http://' + |
|
118 | config.net.address + |
116 | config.net.address + |
|
Line 138... | Line 136... | |||
138 | cert: certificates.certificate, |
136 | cert: certificates.certificate, |
|
139 | }, |
137 | }, |
|
140 | (request, response) => |
138 | (request, response) => |
|
141 | handler.process(config, request, response, root, (result) => { |
139 | handler.process(config, request, response, root, (result) => { |
|
142 | // Log the message by severity. |
140 | // Log the message by severity. |
|
143 | log.log(result.severity, result.message); |
141 | log.log(logging.severity, logging.message); |
|
144 | if(result.status) |
- | ||
145 | response.status = result.status; |
- | ||
146 | |
142 | |
|
147 | // If no data stream is made available or the content type is not |
- | ||
148 | // set then there is no further reason to bother with the request. |
143 | // If no result is to be processed, then terminate the request. |
|
149 | if(typeof result.data === 'undefined' || result.data === null || |
- | ||
150 | typeof result.type === 'undefined' || result.type === null) |
144 | if (typeof result === 'undefined' || result === null) |
|
151 | return; |
145 | return; |
|
152 | |
146 | |
|
- | 147 | // Set the response status. |
||
- | 148 | response.status = result.status; |
||
153 | // Set the content type and send the data. |
149 | // Set the content type and send the data. |
|
154 | response.setHeader('Content-Type', result.type); |
150 | response.setHeader('Content-Type', result.type); |
|
155 | result.data |
151 | result.data |
|
156 | .on('open', () => result.data.pipe(response)); |
152 | .on('readable', () => result.data.pipe(response)) |
|
- | 153 | .on('end', () => response.end()); |
||
157 | }) |
154 | }) |
|
158 | ).listen(config.ssl.port, config.ssl.address, () => { |
155 | ).listen(config.ssl.port, config.ssl.address, () => { |
|
159 | log.info('HTTPs Server accessible at: https://' + |
156 | log.info('HTTPs Server accessible at: https://' + |
|
160 | config.ssl.address + |
157 | config.ssl.address + |
|
161 | ':' + |
158 | ':' + |