diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-10-28 00:01:15 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-10-28 00:02:29 +0100 |
| commit | 314c91d62441415d175aa366764754eb64efa4f7 (patch) | |
| tree | 4793c839dbc32f5a5f93b18d123bec6f8a9f69d5 /src | |
| parent | a42e660627fe5715f6f4d5a9215394baec775726 (diff) | |
| download | chawan-314c91d62441415d175aa366764754eb64efa4f7.tar.gz | |
xhr: fix onReadXHR EAGAIN handling
now it loads invidious comments. wow
Diffstat (limited to 'src')
| -rw-r--r-- | src/html/xmlhttprequest.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/html/xmlhttprequest.nim b/src/html/xmlhttprequest.nim index c1677bbd..50c963c1 100644 --- a/src/html/xmlhttprequest.nim +++ b/src/html/xmlhttprequest.nim @@ -238,15 +238,15 @@ proc onReadXHR(response: Response) = let this = opaque.this let window = opaque.window while true: + let olen = this.received.len + this.received.setLen(olen + BufferSize) try: - let olen = this.received.len - this.received.setLen(olen + BufferSize) let n = response.body.recvData(addr this.received[olen], BufferSize) - if n < BufferSize: - this.received.setLen(olen + n) + this.received.setLen(olen + n) if n == 0: break except ErrorAgain: + this.received.setLen(olen) break if this.readyState == xhrsHeadersReceived: this.readyState = xhrsLoading |