Wapp

Decode query parameters in local mode
Login

Decode query parameters in local mode

(1) By Georg Lehner (jorge-leon) on 2020-09-19 14:15:41 [link] [source]

While creating my first simple application with Wapp - a very pleasant experience - I have trouble to get the query parameters. I am using local wapp_mode.

When using wapp-allow-xorigin-params the query parameters show up, but that does not sound right to me.

I guess the problem is, that the browser won't ever send a referrer header locally.

My fix for this is the following patch for wapp.tcl:

diff -rN -u old-edfn/wapp.tcl new-edfn/wapp.tcl
--- old-edfn/wapp.tcl	2020-09-19 16:14:01.799108358 +0200
+++ new-edfn/wapp.tcl	2020-09-19 16:14:01.799108358 +0200
@@ -708,7 +708,7 @@
     }
   }
   dict set wapp SAME_ORIGIN $same_origin
-  if {$same_origin} {
+    if {$same_origin || [wapp-param WAPP_MODE]=="local"} {
     wappInt-decode-query-params
   }

Is this the right way? Am I missing something?

(2) By D. Richard Hipp (drh) on 2020-09-21 12:38:00 in reply to 1 [source]

I'm not able to reproduce the problem. What web-browser are you using that does not send a Referrer: header when operating on a loop-back IP address?

(3) By Georg Lehner (jorge-leon) on 2020-09-21 13:59:38 in reply to 2 [link] [source]

This is on the Firefox 80.0.1 (64-bit) browser, here are the request headers from the "Network" developer feature:

GET /?id=12 HTTP/1.1
Host: 127.0.0.1:55857
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.7,de;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cookie: except=Home+Magma
Upgrade-Insecure-Requests: 1
DNT: 1
Pragma: no-cache
Cache-Control: no-cache