interplane.Get Omega
Read in your language

omega-tool-model

First-party Omega tool-use model source, serving harnesses, and verification records

Brought by drakestapleton

branch main Branches Tags History

omega-tool-model / deployment / ui / failure-server.om

723 lines · 20210 bytes Raw Blame History
1note Private local protocol. No model-generated bytes are executed.
2global naddr uchar 110
3global nbuf uchar 8192
4global nfd int 1
5global nerr ulong 1
6text nsock "$HOME/handoffs/omega-tool-deployment-20261105/ui/test.sock"
7text nlock "$HOME/.local/share/omega-tool-model/run/model.lock"
8
9fn naddress to void
10put naddr 0 1
11for i ulong len nsock
12put naddr add i 2 get nsock i
13end
14end
15
16fn nreceive off ulong n ulong timeout long to bool
17p = ulong 0
18deadline = add monons timeout
19while lt p n bound 8192
20left = sub deadline monons
21if le left 0
22ret false
23end
24r = waitio get nfd 0 1 left
25if le r 0
26ret false
27end
28r = recv get nfd 0 nbuf add off p sub n p 64
29if eq r neg long 11
30continue
31end
32if le r 0
33ret false
34end
35p = add p ulong r
36end
37ret true
38end
39
40fn nsend off ulong n ulong to bool
41p = ulong 0
42deadline = add monons long 2000000000
43while lt p n bound 8192
44left = sub deadline monons
45if le left 0
46ret false
47end
48r = waitio get nfd 0 4 left
49if le r 0
50ret false
51end
52r = send get nfd 0 nbuf add off p sub n p 64
53if eq r neg long 11
54continue
55end
56if le r 0
57ret false
58end
59p = add p ulong r
60end
61ret true
62end
63
64fn nlength to ulong
65ret add ulong get nbuf 0 mul ulong get nbuf 1 256
66end
67
68fn nheader n ulong to void
69put nbuf 0 uchar and n 255
70put nbuf 1 uchar and shr n 8 255
71end
72
73fn nstatus code ulong to void
74if eq code 0
75nheader 0
76r = nsend 0 2
77else
78nheader 65535
79put nbuf 2 uchar code
80r = nsend 0 3
81end
82end
83
84note Private, bounded HTTP adapter. No generated text is executed or interpreted as HTML.
85global hreq uchar 12288
86global hbuf uchar 16384
87global haddr uchar 16
88global hopt uchar 4
89global hstat uchar 4
90global hfd int 1
91global hcount ulong 1
92global hend ulong 1
93global hsize ulong 1
94global hseen ulong 1
95global hguard ulong 1
96global hhost ulong 1
97global hroute ulong 1
98text hex "0123456789abcdef"
99
100fn hsend n ulong to bool
101p = ulong 0
102deadline = add monons long 3000000000
103while lt p n bound 16384
104left = sub deadline monons
105if le left 0
106ret false
107end
108r = waitio get hfd 0 4 left
109if le r 0
110ret false
111end
112r = send get hfd 0 hbuf p sub n p 64
113if eq r neg long 11
114continue
115end
116if le r 0
117ret false
118end
119p = add p ulong r
120end
121ret true
122end
123
124fn hfind start ulong total ulong to bool
125while lt add start 3 total bound 8192
126if and eq get hreq start 13 eq get hreq add start 1 10
127if and eq get hreq add start 2 13 eq get hreq add start 3 10
128put hend 0 add start 4
129ret true
130end
131end
132start = add start 1
133end
134ret false
135end
136
137fn hread to bool
138put hcount 0 0
139put hend 0 0
140deadline = add monons long 5000000000
141for step ulong 8192
142n = get hcount 0
143if ge n 8192
144ret false
145end
146left = sub deadline monons
147if le left 0
148ret false
149end
150if le waitio get hfd 0 1 left 0
151ret false
152end
153r = recv get hfd 0 hreq n sub 8192 n 64
154if eq r neg long 11
155continue
156end
157if le r 0
158ret false
159end
160total = add n ulong r
161put hcount 0 total
162start = ulong 0
163if gt n 3
164start = sub n 3
165end
166if hfind start total
167ret true
168end
169end
170ret false
171end
172
173fn hline a ulong b ulong to bool
174if eq a b
175ret true
176end
177if iscl a b
178if ne get hseen 0 0
179ret false
180end
181put hseen 0 1
182p = add a 15
183while lt p b bound 8192
184if not or eq get hreq p 32 eq get hreq p 9
185break
186end
187p = add p 1
188end
189if eq p b
190ret false
191end
192v = ulong 0
193while lt p b bound 8192
194c = get hreq p
195if or lt c 48 gt c 57
196ret false
197end
198v = add mul v 10 ulong sub c 48
199if gt v 4000
200ret false
201end
202p = add p 1
203end
204put hsize 0 v
205ret true
206end
207if iste a b
208ret false
209end
210if isguard a b
211put hguard 0 add get hguard 0 1
212end
213if ishost a b
214if not goodhost a b
215ret false
216end
217put hhost 0 add get hhost 0 1
218end
219ret true
220end
221
222fn hparse to bool
223put hsize 0 0
224put hseen 0 0
225put hguard 0 0
226put hhost 0 0
227put hroute 0 0
228n = get hend 0
229a = ulong 0
230first = true
231for i ulong sub n 1
232c = get hreq i
233if and eq c 13 eq get hreq add i 1 10
234if first
235if isroot a i
236put hroute 0 1
237end
238if isgen a i
239put hroute 0 2
240end
241first = false
242else
243if not hline a i
244ret false
245end
246end
247a = add i 2
248else
249if not first
250if and ge c 65 le c 90
251put hreq i add c 32
252end
253end
254end
255end
256ret eq get hhost 0 1
257end
258
259fn hbody to bool
260n = get hsize 0
261off = get hend 0
262total = add off n
263if or eq n 0 gt n 4000
264ret false
265end
266if gt get hcount 0 total
267ret false
268end
269deadline = add monons long 5000000000
270while lt get hcount 0 total bound 4000
271p = get hcount 0
272left = sub deadline monons
273if le left 0
274ret false
275end
276if le waitio get hfd 0 1 left 0
277ret false
278end
279r = recv get hfd 0 hreq p sub total p 64
280if eq r neg long 11
281continue
282end
283if le r 0
284ret false
285end
286put hcount 0 add p ulong r
287end
288nheader n
289for i ulong n
290c = get hreq add off i
291if eq c 0
292ret false
293end
294put nbuf add i 2 c
295end
296ret true
297end
298
299fn hchunk n ulong to bool
300for i ulong 4
301shift = mul sub 3 i 4
302put hbuf i get hex and shr n shift 15
303end
304put hbuf 4 13
305put hbuf 5 10
306for i ulong n
307put hbuf add i 6 get nbuf i
308end
309put hbuf add n 6 13
310put hbuf add n 7 10
311ret hsend add n 8
312end
313
314fn hstream to void
315started = false
316for frame ulong 1024
317if not nreceive 0 2 30000000000
318if not started
319r = respond502
320end
321ret
322end
323n = nlength
324if eq n 65535
325if not started
326if nreceive 0 1 2000000000
327if eq get nbuf 0 3
328r = respond422
329else
330r = respond502
331end
332else
333r = respond502
334end
335end
336ret
337end
338if gt n 4096
339if not started
340r = respond502
341end
342ret
343end
344if not started
345if not streamhead
346ret
347end
348started = true
349end
350if eq n 0
351r = streamend
352ret
353end
354if not nreceive 0 n 2000000000
355ret
356end
357if not hchunk n
358ret
359end
360end
361end
362
363fn hmodel to void
364naddress
365fd = socknew 1 524289 0
366if lt fd 0
367r = respond503
368ret
369end
370if ne connect int fd naddr 0 add len nsock 3 0
371closed = fclose int fd
372r = respond503
373ret
374end
375put nfd 0 int fd
376if nsend 0 add get hsize 0 2
377hstream
378else
379r = respond502
380end
381closed = fclose int fd
382end
383
384fn hserve to void
385if not hread
386r = respond400
387ret
388end
389if not hparse
390r = respond400
391ret
392end
393route = get hroute 0
394if eq route 1
395if ne get hsize 0 0
396r = respond400
397ret
398end
399r = respondpage
400ret
401end
402if eq route 2
403if or ne get hguard 0 1 ne get hseen 0 1
404r = respond400
405ret
406end
407if not hbody
408r = respond400
409ret
410end
411hmodel
412else
413r = respond404
414end
415end
416
417fn main to int
418put haddr 0 2
419put haddr 2 70
420put haddr 3 255
421put haddr 4 127
422put haddr 7 1
423put hopt 0 1
424fd = socknew 2 524289 0
425if lt fd 0
426ret 70
427end
428r = sockopt int fd 1 2 hopt 0 4
429if ne bind int fd haddr 0 16 0
430ret 71
431end
432if ne listen int fd 16 0
433ret 72
434end
435active = ulong 0
436for request ulong 1000000
437for reap ulong 16
438done = waitpid -1 hstat 0 4 1
439if le done 0
440break
441end
442if gt active 0
443active = sub active 1
444end
445end
446if ge active 16
447r = sleepns 10000000
448continue
449end
450if le waitio int fd 1 1000000000 0
451continue
452end
453client = accept int fd 524288
454if lt client 0
455continue
456end
457pid = fork
458if eq pid 0
459r = fclose int fd
460put hfd 0 int client
461r = sockopt int client 6 1 hopt 0 4
462hserve
463r = fclose int client
464ret 0
465end
466r = fclose int client
467if gt pid 0
468active = add active 1
469end
470end
471ret 0
472end
473
474text t0 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/html; charset=utf-8\nContent-Length: 6781\n\n"
475text page "<!doctype html>\n<html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>Omega · Your model</title>\n<style>\n:root{color-scheme:dark;font:16px/1.55 system-ui,sans-serif;color:#e7edef;background:#101719}*{box-sizing:border-box}body{margin:0}main{max-width:860px;margin:auto;padding:44px 24px}header{display:flex;justify-content:space-between;gap:20px;align-items:center}.mark{letter-spacing:.2em;color:#b8ddc9;font-weight:700;font-size:13px}.badge{border:1px solid #3e5850;border-radius:30px;padding:5px 13px;font-size:13px;color:#b8ddc9}h1{font-size:clamp(30px,6vw,45px);line-height:1.15;margin:34px 0 14px;font-weight:600;letter-spacing:-.035em}p{color:#aab9bc;margin:0 0 22px}.panel{background:#172124;border:1px solid #304044;border-radius:16px;padding:24px;margin-top:24px}label{display:block;font-weight:600;margin-bottom:9px}select,textarea,button{font:inherit}select{background:#101719;color:#e7edef;border:1px solid #4a6268;border-radius:8px;padding:8px 12px;margin-bottom:20px}textarea{width:100%;min-height:150px;resize:vertical;background:#101719;color:#eef5f4;border:1px solid #4a6268;border-radius:10px;padding:15px}textarea:focus,select:focus,button:focus-visible{outline:2px solid #a4dbbc;outline-offset:3px}.hint{font-size:13px;margin-top:8px}.actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:18px}button{cursor:pointer;border:0;border-radius:9px;padding:10px 17px;font-weight:600;background:#b8ddc9;color:#14231a}button:disabled{opacity:.5;cursor:wait}.secondary{background:transparent;color:#c0d5dc;border:1px solid #486169;font-size:13px;padding:7px 12px}.examples{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.output-title{display:flex;justify-content:space-between;align-items:center;gap:12px}h2{font-size:17px;margin:0}pre{white-space:pre-wrap;overflow-wrap:anywhere;min-height:70px;line-height:1.6;font-size:14px;margin:18px 0 0;color:#d0eadc}#status{font-size:14px;color:#b8cccf}#status.error{color:#ffb5a9}footer{margin-top:24px;font-size:13px;color:#9aafb4}button:hover{filter:brightness(1.08)}@media(max-width:500px){main{padding:26px 16px}.panel{padding:18px}}\n</style></head><body><main>\n<header><span class=\"mark\">OMEGA</span><span class=\"badge\">Round 40 · Fast model</span></header>\n<h1>Your model, ready to try.</h1>\n<p>Give it a small Omega coding task, or explore what it writes next. This is the model you trained, running on your Spark.</p>\n<form id=\"ask\" class=\"panel\"><label for=\"mode\">What would you like to try?</label>\n<select id=\"mode\"><option value=\"task\">An Omega task</option><option value=\"raw\">Continue text / exact prompt</option></select>\n<label for=\"prompt\">Your request</label><textarea id=\"prompt\" maxlength=\"4000\" required placeholder=\"Write Omega that returns the larger of 24 and 27.\"></textarea>\n<p class=\"hint\">Keep it short. Each request starts fresh, without previous messages.</p>\n<div class=\"examples\"><button type=\"button\" class=\"secondary\" data-example=\"larger\">Compare two numbers</button><button type=\"button\" class=\"secondary\" data-example=\"tool\">Try a tool response</button></div>\n<div class=\"actions\"><button id=\"run\" type=\"submit\">Ask the model</button><button id=\"stop\" class=\"secondary\" type=\"button\" hidden>Stop</button><span id=\"status\" role=\"status\" aria-live=\"polite\">Ready when you are.</span></div></form>\n<section class=\"panel\" aria-label=\"Model response\"><div class=\"output-title\"><h2>Model response</h2><button type=\"button\" id=\"copy\" class=\"secondary\" disabled>Copy</button></div><pre id=\"output\" tabindex=\"0\">Its response will appear here.</pre></section>\n<footer>This is a small model trained for specific Omega tasks and tool responses. General conversation and unfamiliar tasks may produce mistakes. Tool requests are displayed here; they do not run or change files.</footer>\n</main><script>\nconst $=id=>document.getElementById(id);\nlet controller=null;\nconst examples={larger:{mode:'task',text:'Write Omega that returns the larger of 24 and 27.'},tool:{mode:'raw',text:'Task: Fix the error in this file and confirm its goal.\\nFile: jobs/item76666.om\\nGoal: calc starts with x and adds 4 exactly 3 times in a for loop. main calls calc with 70.\\nState: unread\\nAnswer:\\n'}};\ndocument.querySelectorAll('[data-example]').forEach(b=>b.addEventListener('click',()=>{const e=examples[b.dataset.example];$('mode').value=e.mode;$('prompt').value=e.text;$('prompt').focus();}));\nfunction status(text,error=false){$('status').textContent=text;$('status').className=error?'error':'';}\n$('stop').addEventListener('click',()=>controller?.abort());\n$('ask').addEventListener('submit',async e=>{\n e.preventDefault();if(controller)return;\n const input=$('prompt').value;if(!input.trim())return;\n const prompt=$('mode').value==='task'?'Task: '+input.trim()+'\\nAnswer:\\n':input;\n if(new TextEncoder().encode(prompt).length>4000){status('Please shorten your request.',true);return;}\n controller=new AbortController();const started=performance.now();let timer=setTimeout(()=>controller?.abort(),45000);\n $('run').disabled=true;$('stop').hidden=false;$('copy').disabled=true;$('output').textContent='';status('Waiting for the model…');\n try{\n const response=await fetch('/generate',{method:'POST',headers:{'Content-Type':'text/plain;charset=UTF-8','X-Omega-UI':'1'},body:prompt,signal:controller.signal});\n if(!response.ok)throw new Error((await response.text()).trim()||'The request could not be completed.');\n const reader=response.body.getReader(),decoder=new TextDecoder();let first=true;\n while(true){const {value,done}=await reader.read();if(done)break;$('output').textContent+=decoder.decode(value,{stream:true});if(first){status('Receiving the response…');first=false;}}\n $('output').textContent+=decoder.decode();status('Finished in '+Math.round(performance.now()-started)+' ms.');\n if(!$('output').textContent)$('output').textContent='The model finished without any text. Try one of the examples.';\n }catch(error){status(error.name==='AbortError'?'Stopped. Any response shown may be incomplete.':error.message,true);}\n finally{clearTimeout(timer);controller=null;$('run').disabled=false;$('stop').hidden=true;$('copy').disabled=!$('output').textContent;}\n});\n$('copy').addEventListener('click',async()=>{\n const text=$('output').textContent;\n try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(text);}else{const area=document.createElement('textarea');area.value=text;area.style.position='fixed';area.style.opacity='0';document.body.appendChild(area);area.select();const ok=document.execCommand('copy');area.remove();if(!ok)throw new Error('copy');}status('Response copied.');}catch{status('Select the response text to copy it.',true);}\n});\n</script></body></html>\n"
476fn respondpage to bool
477p = ulong 0
478for i ulong len t0
479c = get t0 i
480if eq c 10
481put hbuf p 13
482p = add p 1
483end
484put hbuf p c
485p = add p 1
486end
487for i ulong len page
488put hbuf p get page i
489p = add p 1
490end
491ret hsend p
492end
493text t1 "HTTP/1.1 400 Bad Request\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 55\n\nPlease send a short, nonempty request using this page.\n"
494fn respond400 to bool
495p = ulong 0
496for i ulong len t1
497c = get t1 i
498if eq c 10
499put hbuf p 13
500p = add p 1
501end
502put hbuf p c
503p = add p 1
504end
505put hbuf sub p 2 10
506p = sub p 1
507ret hsend p
508end
509text t2 "HTTP/1.1 404 Not Found\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 16\n\nPage not found.\n"
510fn respond404 to bool
511p = ulong 0
512for i ulong len t2
513c = get t2 i
514if eq c 10
515put hbuf p 13
516p = add p 1
517end
518put hbuf p c
519p = add p 1
520end
521put hbuf sub p 2 10
522p = sub p 1
523ret hsend p
524end
525text t3 "HTTP/1.1 422 Unprocessable Content\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 73\n\nThis request is too long for the model. Please shorten it and try again.\n"
526fn respond422 to bool
527p = ulong 0
528for i ulong len t3
529c = get t3 i
530if eq c 10
531put hbuf p 13
532p = add p 1
533end
534put hbuf p c
535p = add p 1
536end
537put hbuf sub p 2 10
538p = sub p 1
539ret hsend p
540end
541text t4 "HTTP/1.1 502 Bad Gateway\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 54\n\nThe model response was interrupted. Please try again.\n"
542fn respond502 to bool
543p = ulong 0
544for i ulong len t4
545c = get t4 i
546if eq c 10
547put hbuf p 13
548p = add p 1
549end
550put hbuf p c
551p = add p 1
552end
553put hbuf sub p 2 10
554p = sub p 1
555ret hsend p
556end
557text t5 "HTTP/1.1 503 Service Unavailable\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nContent-Length: 60\n\nThe model service is unavailable. Please try again shortly.\n"
558fn respond503 to bool
559p = ulong 0
560for i ulong len t5
561c = get t5 i
562if eq c 10
563put hbuf p 13
564p = add p 1
565end
566put hbuf p c
567p = add p 1
568end
569put hbuf sub p 2 10
570p = sub p 1
571ret hsend p
572end
573text t6 "HTTP/1.1 200 OK\nConnection: close\nCache-Control: no-store\nX-Content-Type-Options: nosniff\nReferrer-Policy: no-referrer\nContent-Security-Policy: default-src 'none'; script-src 'sha256-5SHsnAF2/hAOBEsKCZQlJG0wlxw7hSWS7p2IGep8vuM='; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'\nContent-Type: text/plain; charset=utf-8\nTransfer-Encoding: chunked\nX-Accel-Buffering: no\n\n"
574fn streamhead to bool
575p = ulong 0
576for i ulong len t6
577c = get t6 i
578if eq c 10
579put hbuf p 13
580p = add p 1
581end
582put hbuf p c
583p = add p 1
584end
585ret hsend p
586end
587text t7 "0\n\n"
588fn streamend to bool
589p = ulong 0
590for i ulong len t7
591c = get t7 i
592if eq c 10
593put hbuf p 13
594p = add p 1
595end
596put hbuf p c
597p = add p 1
598end
599ret hsend p
600end
601text m0 "GET / HTTP/1.1"
602fn isroot a ulong b ulong to bool
603if ne sub b a len m0
604ret false
605end
606for i ulong len m0
607if ne get hreq add a i get m0 i
608ret false
609end
610end
611ret true
612end
613text m1 "POST /generate HTTP/1.1"
614fn isgen a ulong b ulong to bool
615if ne sub b a len m1
616ret false
617end
618for i ulong len m1
619if ne get hreq add a i get m1 i
620ret false
621end
622end
623ret true
624end
625text m2 "content-length:"
626fn iscl a ulong b ulong to bool
627if lt sub b a len m2
628ret false
629end
630for i ulong len m2
631if ne get hreq add a i get m2 i
632ret false
633end
634end
635ret true
636end
637text m3 "transfer-encoding:"
638fn iste a ulong b ulong to bool
639if lt sub b a len m3
640ret false
641end
642for i ulong len m3
643if ne get hreq add a i get m3 i
644ret false
645end
646end
647ret true
648end
649text m4 "x-omega-ui: 1"
650fn isguard a ulong b ulong to bool
651if ne sub b a len m4
652ret false
653end
654for i ulong len m4
655if ne get hreq add a i get m4 i
656ret false
657end
658end
659ret true
660end
661text m5 "host:"
662fn ishost a ulong b ulong to bool
663if lt sub b a len m5
664ret false
665end
666for i ulong len m5
667if ne get hreq add a i get m5 i
668ret false
669end
670end
671ret true
672end
673text m6 "host: 127.0.0.1:18175"
674fn host0 a ulong b ulong to bool
675if ne sub b a len m6
676ret false
677end
678for i ulong len m6
679if ne get hreq add a i get m6 i
680ret false
681end
682end
683ret true
684end
685text m7 "host: localhost:18175"
686fn host1 a ulong b ulong to bool
687if ne sub b a len m7
688ret false
689end
690for i ulong len m7
691if ne get hreq add a i get m7 i
692ret false
693end
694end
695ret true
696end
697text m8 "host: 127.0.0.1:18174"
698fn host2 a ulong b ulong to bool
699if ne sub b a len m8
700ret false
701end
702for i ulong len m8
703if ne get hreq add a i get m8 i
704ret false
705end
706end
707ret true
708end
709text m9 "host: localhost:18174"
710fn host3 a ulong b ulong to bool
711if ne sub b a len m9
712ret false
713end
714for i ulong len m9
715if ne get hreq add a i get m9 i
716ret false
717end
718end
719ret true
720end
721fn goodhost a ulong b ulong to bool
722ret or or host0 a b host1 a b or host2 a b host3 a b
723end