@webqit/webflo 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -141,7 +141,7 @@ export class WebfloWorker extends WebfloRuntime {
|
|
|
141
141
|
// Create and route request
|
|
142
142
|
scope.request = this.createRequest(scope.url, scope.init);
|
|
143
143
|
scope.cookies = this.constructor.CookieStorage.create(scope.request);
|
|
144
|
-
scope.session = this.constructor.SessionStorage.create(scope.request
|
|
144
|
+
scope.session = this.constructor.SessionStorage.create(scope.request);
|
|
145
145
|
const portID = crypto.randomUUID();
|
|
146
146
|
scope.clientMessaging = new ClientMessaging(this, portID, { isPrimary: true });
|
|
147
147
|
scope.user = this.constructor.HttpUser.create(
|
|
@@ -120,7 +120,6 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
120
120
|
|
|
121
121
|
control() {
|
|
122
122
|
// ---------------
|
|
123
|
-
console.log('________port 1:', this.#cx.server.port);
|
|
124
123
|
if (!this.#cx.flags['test-only'] && !this.#cx.flags['https-only'] && this.#cx.server.port) {
|
|
125
124
|
const httpServer = Http.createServer((request, response) => this.handleNodeHttpRequest(request, response));
|
|
126
125
|
httpServer.listen(this.#cx.server.port);
|
|
@@ -138,7 +137,6 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
138
137
|
});
|
|
139
138
|
}
|
|
140
139
|
// ---------------
|
|
141
|
-
console.log('________port 1:', this.#cx.server.https.port);
|
|
142
140
|
if (!this.#cx.flags['test-only'] && !this.#cx.flags['http-only'] && this.#cx.server.https.port) {
|
|
143
141
|
const httpsServer = Https.createServer((request, response) => this.handleNodeHttpRequest(request, response));
|
|
144
142
|
httpsServer.listen(this.#cx.server.https.port);
|
|
@@ -174,7 +172,6 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
174
172
|
}
|
|
175
173
|
|
|
176
174
|
getRequestProto(nodeRequest) {
|
|
177
|
-
console.log({ encrypted: nodeRequest.connection.encrypted, headers: nodeRequest });
|
|
178
175
|
return nodeRequest.connection.encrypted ? 'https' : (nodeRequest.headers['x-forwarded-proto'] || 'http');
|
|
179
176
|
}
|
|
180
177
|
|
|
@@ -182,6 +179,7 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
182
179
|
async handleNodeWsRequest(wss, nodeRequest, socket, head) {
|
|
183
180
|
const proto = this.getRequestProto(nodeRequest);
|
|
184
181
|
console.log('__________ws:', proto);
|
|
182
|
+
|
|
185
183
|
const [fullUrl, requestInit] = this.parseNodeRequest(proto, nodeRequest, false);
|
|
186
184
|
const scope = {};
|
|
187
185
|
scope.url = new URL(fullUrl);
|
|
@@ -242,6 +240,8 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
242
240
|
|
|
243
241
|
async handleNodeHttpRequest(nodeRequest, nodeResponse) {
|
|
244
242
|
const proto = this.getRequestProto(nodeRequest);
|
|
243
|
+
console.log('__________http:', proto);
|
|
244
|
+
|
|
245
245
|
const [fullUrl, requestInit] = this.parseNodeRequest(proto, nodeRequest);
|
|
246
246
|
const scope = {};
|
|
247
247
|
scope.url = new URL(fullUrl);
|
|
@@ -580,7 +580,6 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
580
580
|
const is404 = response.status === 404;
|
|
581
581
|
if (is404) return response;
|
|
582
582
|
const acceptedOrUnchanged = [202/*Accepted*/, 304/*Not Modified*/].includes(response.status);
|
|
583
|
-
const t = response.status === 404;
|
|
584
583
|
if (httpEvent.request.headers.get('Accept')) {
|
|
585
584
|
const requestAccept = httpEvent.request.headers.get('Accept', true);
|
|
586
585
|
if (requestAccept.match('text/html') && !response.meta.static) {
|
|
@@ -595,9 +594,6 @@ export class WebfloServer extends WebfloRuntime {
|
|
|
595
594
|
// Satisfy "Range" header
|
|
596
595
|
if (httpEvent.request.headers.get('Range') && !response.headers.get('Content-Range')
|
|
597
596
|
&& (response.body instanceof ReadableStream || ArrayBuffer.isView(response.body))) {
|
|
598
|
-
if (t) {
|
|
599
|
-
console.log(httpEvent.request.url, response.body);
|
|
600
|
-
}
|
|
601
597
|
const rangeRequest = httpEvent.request.headers.get('Range', true);
|
|
602
598
|
const body = _ReadableStream.from(response.body);
|
|
603
599
|
// ...in partials
|