aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-04-05 23:39:52 +0200
committerbptato <nincsnevem662@gmail.com>2025-04-05 23:41:04 +0200
commit210f406e7351f8e22daa5d581120a8352604eae9 (patch)
treea4e3bdfe87bc04db32b4ed5e8772af62cda406df /test
parent7c6cd028d01f893644c5e2e26251a2ff950f7950 (diff)
downloadchawan-210f406e7351f8e22daa5d581120a8352604eae9.tar.gz
loader: support Set-Cookie for non-initial requests
For compatibility with mainstream browsers. e.g. this should allow log-ins through ajax. To synchronize the loader's cookie jar with that of the pager, we open a stream (about:cookie-stream) to pass over serialized cookies when required.
Diffstat (limited to 'test')
-rw-r--r--test/net/cookie.css.http4
-rw-r--r--test/net/cookie.http4
-rwxr-xr-xtest/net/run.sh5
3 files changed, 11 insertions, 2 deletions
diff --git a/test/net/cookie.css.http b/test/net/cookie.css.http
new file mode 100644
index 00000000..72b9a993
--- /dev/null
+++ b/test/net/cookie.css.http
@@ -0,0 +1,4 @@
+Content-Type: text/css
+Set-Cookie: test9=css
+
+#y { display: none }
diff --git a/test/net/cookie.http b/test/net/cookie.http
index bd9fabb4..d0abe683 100644
--- a/test/net/cookie.http
+++ b/test/net/cookie.http
@@ -9,7 +9,9 @@ Set-Cookie: test6=hi; Max-Age=9223372036854775807
Set-Cookie: test7=hi; Expires=Mon 0 Jan 1999 20:30:00 GMT
Set-Cookie: test8=hi; Expires=Mon, 31 Feb 1999 20:30:00 GMT
+<link rel=stylesheet href=cookie.css.http>
<div id=x>Fail</div>
+<div id=y>CSS fail</div>
<script src=asserts.js></script>
<script>
const x = new XMLHttpRequest();
@@ -17,6 +19,6 @@ x.open("GET", "headers", false);
x.overrideMimeType("text/plain");
x.send();
const cookie = x.responseText.split('\n').find(x => x.startsWith("cookie:"));
-assertEquals(cookie.split(': ').pop(), "test=asdfasdf; SID=31d4d96e407aad42; test3=x; test4=y; test6=hi; test7=hi; test8=hi");
+assertEquals(cookie.split(': ').pop(), "test=asdfasdf; SID=31d4d96e407aad42; test3=x; test4=y; test6=hi; test7=hi; test8=hi; test9=css");
document.getElementById("x").textContent = "Success";
</script>
diff --git a/test/net/run.sh b/test/net/run.sh
index a257cefc..539de55d 100755
--- a/test/net/run.sh
+++ b/test/net/run.sh
@@ -6,7 +6,10 @@ fi
failed=0
for h in *.html *.http
-do printf '%s\r' "$h"
+do case $h in
+ cookie.css.http) continue;;
+ esac
+ printf '%s\r' "$h"
if ! "$CHA" -C config.toml "http://localhost:$1/$h" | diff all.expected -
then failed=$(($failed+1))
printf 'FAIL: %s\n' "$h"