From 7c4bb940410c8f5ad59e1d21d5565364a9a0cd71 Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 20 May 2024 18:12:09 +0200 Subject: html: improve Request, derive Client from Window * make Client an instance of Window (for less special casing) * misc work on Request & fetch * improve origin comparison (opaque origins of same URLs are now considered the same) --- src/server/buffer.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/server/buffer.nim') diff --git a/src/server/buffer.nim b/src/server/buffer.nim index 54c32de3..178dd94b 100644 --- a/src/server/buffer.nim +++ b/src/server/buffer.nim @@ -887,7 +887,8 @@ proc setHTML(buffer: Buffer) = buffer.attrs, factory, navigate, - some(buffer.loader) + buffer.loader, + buffer.url ) let confidence = if buffer.config.charsetOverride == CHARSET_UNKNOWN: ccTentative @@ -1317,10 +1318,10 @@ proc submitForm(form: HTMLFormElement; submitter: Element): Option[Request] = #TODO return none(Request) let httpmethod = if formmethod == fmGet: - HTTP_GET + hmGet else: assert formmethod == fmPost - HTTP_POST + hmPost #let target = if submitter.isSubmitButton() and submitter.attrb("formtarget"): # submitter.attr("formtarget") @@ -1549,7 +1550,7 @@ proc click(buffer: Buffer; anchor: HTMLAnchorElement): ClickResult = repaint = true if s.isSome: let url = newURL("data:text/html," & s.get).get - let req = newRequest(url, HTTP_GET) + let req = newRequest(url, hmGet) return ClickResult( repaint: repaint, open: some(req) @@ -1559,7 +1560,7 @@ proc click(buffer: Buffer; anchor: HTMLAnchorElement): ClickResult = ) return ClickResult( repaint: repaint, - open: some(newRequest(url, HTTP_GET)) + open: some(newRequest(url, hmGet)) ) return ClickResult(repaint: repaint) -- cgit 1.4.1-2-gfad0