aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / allen / tests / http.om
| 1 | note HTTP response boundary tests; concatenate after base.om, github.om, http.om, tests/check.om. |
| 2 | note Fixtures are protocol data only. This gate makes no network or TLS qualification claim. |
| 3 | text Hcases "HTTP/1.1 200 OK\nContent-Length: 5\n\nhello|HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n\n2;ext=yes\nhe\n3\nllo\n0\nX-Trace: safe\n\n|HTTP/1.1 200 OK\nContent-Length: 5\nContent-Length: 5\n\nhello|HTTP/1.1 200 OK\nContent-Length: 5\nTransfer-Encoding: chunked\n\n|HTTP/1.1 200 OK\nContent-Encoding: gzip\nContent-Length: 5\n\nhello|HTTP/1.1 200 OK\nContent-Length: 9999999999999999999999999\n\n|HTTP/1.1 200 OK\n\nhello|HTTP/1.1 200 OK\nContent-Length: 5\n\nhell|HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n\n1\nh\n0\nContent-Length: 0\n\n|HTTP/1.1 103 Early Hints\nLink: x\n\nHTTP/1.1 200 OK\nContent-Length: 5\n\nhello|HTTP/1.1 200 OK\nContent-Length: 0\n\nx|HTTP/1.1 200 OK\nTransfer-Encoding: chunked\n\n6\nhello!\n0\n\n|HTTP/1.1 204 No Content\nContent-Length: 4\n\n|HTTP/1.1 403 Forbidden\nContent-Length: 2\n\n{}|HTTP/1.1 200 OK\nTransfer-Encoding: chunked, gzip\n\n|HTTP/1.1 200 OK\nBad Header: x\n\n|" |
| 4 | text Hpath "/repos/aien-dev/allen" |
| 5 | text Hhello "hello" |
| 6 | fn htbegin cap ulong to void |
| 7 | for i ulong len Hpath |
| 8 | put Ghpath i get Hpath i |
| 9 | end |
| 10 | check httpstart 1 42 0 cap len Hpath 1 |
| 11 | end |
| 12 | fn htpush c uchar to void |
| 13 | put Hchunk 0 c |
| 14 | ok = httpfeed 1 |
| 15 | end |
| 16 | fn htcase wanted ulong to void |
| 17 | index = ulong 0 |
| 18 | for i ulong len Hcases |
| 19 | c = get Hcases i |
| 20 | if eq c 124 |
| 21 | if eq index wanted |
| 22 | ret |
| 23 | end |
| 24 | index = add index 1 |
| 25 | else |
| 26 | if eq index wanted |
| 27 | if eq c 10 |
| 28 | htpush 13 |
| 29 | end |
| 30 | htpush c |
| 31 | end |
| 32 | end |
| 33 | end |
| 34 | end |
| 35 | fn htgood id ulong to void |
| 36 | check eq get Hstate 0 2 id |
| 37 | check eq get Hstate 2 5 add id 1 |
| 38 | ok = true |
| 39 | for i ulong 5 |
| 40 | if ne get Ghbody i get Hhello i |
| 41 | ok = false |
| 42 | end |
| 43 | end |
| 44 | check ok add id 2 |
| 45 | check eq get Hstate 3 42 add id 3 |
| 46 | end |
| 47 | fn main to int |
| 48 | htbegin 5 |
| 49 | htcase 0 |
| 50 | htgood 10 |
| 51 | htbegin 5 |
| 52 | htcase 1 |
| 53 | htgood 20 |
| 54 | for i ulong 4 |
| 55 | htbegin 5 |
| 56 | htcase add i 2 |
| 57 | check eq get Hstate 0 3 add 30 i |
| 58 | end |
| 59 | htbegin 5 |
| 60 | htcase 6 |
| 61 | check eq get Hstate 0 1 40 |
| 62 | check httpend true 41 |
| 63 | htgood 42 |
| 64 | htbegin 5 |
| 65 | htcase 6 |
| 66 | check not httpend false 46 |
| 67 | check eq get Hstate 0 3 47 |
| 68 | htbegin 5 |
| 69 | htcase 7 |
| 70 | check not httpend true 50 |
| 71 | check eq get Hstate 0 3 51 |
| 72 | htbegin 5 |
| 73 | htcase 8 |
| 74 | check eq get Hstate 0 3 52 |
| 75 | htbegin 5 |
| 76 | htcase 9 |
| 77 | htgood 60 |
| 78 | for i ulong 3 |
| 79 | htbegin 5 |
| 80 | htcase add i 10 |
| 81 | check eq get Hstate 0 3 add 70 i |
| 82 | end |
| 83 | htbegin 5 |
| 84 | htcase 13 |
| 85 | check eq get Hstate 0 2 80 |
| 86 | check eq get Hstate 1 403 81 |
| 87 | check eq get Hstate 2 2 82 |
| 88 | for i ulong 2 |
| 89 | htbegin 5 |
| 90 | htcase add i 14 |
| 91 | check eq get Hstate 0 3 add 85 i |
| 92 | end |
| 93 | htbegin 5 |
| 94 | htpush 10 |
| 95 | check eq get Hstate 0 3 90 |
| 96 | htbegin 5 |
| 97 | put Ghpath 1 13 |
| 98 | check not httpstart 1 43 0 5 len Hpath 91 |
| 99 | check eq get Httpreqn 0 0 92 |
| 100 | htbegin 5 |
| 101 | put Ghpath 1 35 |
| 102 | check not httpstart 1 43 0 5 len Hpath 93 |
| 103 | check eq get Httpreqn 0 0 94 |
| 104 | ret int get Fails 0 |
| 105 | end |