about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-14 15:44:32 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-14 15:44:32 +0100
commit547a492611a8d6831d88b697e2785658a9c06177 (patch)
treec5fa38683acc29e4d70396d5f4d96346f453b469 /src/types
parentc2fbe0993228b2b62f8a916bae5271097254ce5c (diff)
downloadchawan-547a492611a8d6831d88b697e2785658a9c06177.tar.gz
Various refactorings & fixes
* disallow Stream interface usage on non-blocking PosixStreams
* do not read estream of forkserver byte-by-byte (it's slow)
* do not call writeData with a zero len in formdata
* do not quote numbers in mailcap quoteFile
* remove some unused stuff
Diffstat (limited to 'src/types')
-rw-r--r--src/types/buffersource.nim11
-rw-r--r--src/types/formdata.nim5
2 files changed, 4 insertions, 12 deletions
diff --git a/src/types/buffersource.nim b/src/types/buffersource.nim
deleted file mode 100644
index 60fd7137..00000000
--- a/src/types/buffersource.nim
+++ /dev/null
@@ -1,11 +0,0 @@
-import std/options
-
-import loader/request
-
-import chakasu/charset
-
-type
-  BufferSource* = object
-    contentType*: Option[string] # override
-    charset*: Charset # fallback
-    request*: Request
diff --git a/src/types/formdata.nim b/src/types/formdata.nim
index 02a08d15..29817e54 100644
--- a/src/types/formdata.nim
+++ b/src/types/formdata.nim
@@ -79,8 +79,11 @@ proc writeEntry*(stream: Stream, entry: FormDataEntry, boundary: string) =
         var buf {.noinit.}: array[4096, uint8]
         while true:
           let n = fs.readData(addr buf[0], 4096)
+          if n == 0:
+            break
           stream.writeData(addr buf[0], n)
-          if n != 4096: break
+          if n < buf.len:
+            break
     else:
       stream.writeData(blob.buffer, int(blob.size))
     stream.write("\r\n")