Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/omega/allen/tests/https-live.om # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / omega / allen / tests / https-live.om` 186 lines ยท 2813 bytes Raw Blame History 1 note SPDX-License-Identifier: MIT 2 note Qualification only: real Omega TLS/HTTP client on Linux AArch64. 3 note Argument1 is a DNS-resolved IPv4 address supplied by the external test orchestrator. 4 note Production firmware build uses net.om DNS instead; this harness is not the deployed network provider. 5 global Laddr uchar 16 6 global Lip uchar 32 7 global Lfd int 1 8 global Lstate ulong 4 9 text Lpath "/repos/aien-dev/allen" 10 fn laddress to bool 11 n = argread 1 Lip 0 len Lip 12 if or le n 0 gt n 15 13 ret false 14 end 15 put Laddr 0 2 16 put Laddr 2 1 17 put Laddr 3 187 18 part = ulong 0 19 value = ulong 0 20 digits = ulong 0 21 for i ulong add ulong n 1 22 c = uchar 46 23 if lt i ulong n 24 c = get Lip i 25 end 26 if eq c 46 27 if or or eq digits 0 gt value 255 ge part 4 28 ret false 29 end 30 put Laddr add 4 part uchar value 31 part = add part 1 32 value = 0 33 digits = 0 34 else 35 if or lt c 48 gt c 57 36 ret false 37 end 38 digits = add digits 1 39 if gt digits 3 40 ret false 41 end 42 value = add mul value 10 sub ulong c 48 43 end 44 end 45 ret eq part 4 46 end 47 fn lflush to bool 48 off = ulong 0 49 while lt off get Tlsoutn 0 50 n = send get Lfd 0 Tlsout off sub get Tlsoutn 0 off 0 51 if gt n 0 52 off = add off ulong n 53 else 54 if ne n -11 55 ret false 56 end 57 r = waitio get Lfd 0 4 `10000000000` 58 if le r 0 59 ret false 60 end 61 end 62 end 63 tlssent 64 ret true 65 end 66 fn lhttp to bool 67 while gt get Tlsappn 0 0 68 n = get Tlsappn 0 69 if gt n len Hchunk 70 n = len Hchunk 71 end 72 for i ulong n 73 put Hchunk i get Tlsapp i 74 end 75 if not httpfeed n 76 ret false 77 end 78 tlsconsume n 79 end 80 ret true 81 end 82 fn ldrive to int 83 start = monons 84 sent = false 85 while eq get Hstate 0 1 86 if gt sub monons start `120000000000` 87 ret 71 88 end 89 if eq get Tlsstate 0 4 90 ret 72 91 end 92 if gt get Tlsoutn 0 0 93 if not lflush 94 ret 73 95 end 96 end 97 if and eq get Tlsstate 0 2 not sent 98 for i ulong get Httpreqn 0 99 put Tlsplain i get Httpreq i 100 end 101 if tlswrite get Httpreqn 0 102 sent = true 103 end 104 end 105 if not lhttp 106 ret 74 107 end 108 if eq get Hstate 0 2 109 break 110 end 111 if eq get Tlsstate 0 3 112 if not httpend eq get Tlsstate 2 1 113 ret 75 114 end 115 break 116 end 117 if eq get Tlsoutn 0 0 118 r = waitio get Lfd 0 1 `1000000000` 119 if lt r 0 120 ret 76 121 end 122 if gt r 0 123 n = recv get Lfd 0 Tlsin 0 len Tlsin 0 124 if gt n 0 125 tlsinput ulong n 126 else 127 if eq n 0 128 ret 77 129 end 130 if ne n -11 131 ret 78 132 end 133 end 134 end 135 end 136 end 137 if ne get Hstate 1 200 138 ret 79 139 end 140 n = write 1 Ghbody 0 get Hstate 2 141 if ne n long get Hstate 2 142 ret 80 143 end 144 ret 0 145 end 146 fn main to int 147 if ne argcnt 2 148 ret 64 149 end 150 if not laddress 151 ret 65 152 end 153 for i ulong len Lpath 154 put Ghpath i get Lpath i 155 end 156 if not httpstart 1 1 0 65536 len Lpath 157 ret 66 158 end 159 off = ulong 0 160 while lt off len Tlsrand 161 n = random Tlsrand off sub len Tlsrand off 0 162 if le n 0 163 ret 67 164 end 165 off = add off ulong n 166 end 167 now = realns 168 if le now 0 169 ret 68 170 end 171 tlsinit ulong div now `1000000000` 172 fd = socknew 2 526337 0 173 if lt fd 0 174 ret 69 175 end 176 put Lfd 0 int fd 177 r = connect int fd Laddr 0 len Laddr 178 if and ne r 0 ne r -115 179 r = fclose int fd 180 ret 70 181 end 182 rc = ldrive 183 r = fclose int fd 184 tcwipe 185 ret rc 186 end