Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/string-accumulate.carp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(load "Bench.carp")
(load "git@github.com:carpentry-org/strbuf@0.2.1")
(load "git@github.com:carpentry-org/strbuf@0.3.0")

; Build an array of n string chunks of the given size.
(defn make-chunks [n size]
Expand Down
10 changes: 4 additions & 6 deletions http-client.carp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(load "git@github.com:carpentry-org/socket@0.2.5")
(load "git@github.com:carpentry-org/http@0.5.0")
(load "git@github.com:carpentry-org/http@0.6.0")
(load "git@github.com:carpentry-org/tls@0.2.1")
(load "git@github.com:carpentry-org/strbuf@0.2.1")
(load "git@github.com:carpentry-org/strbuf@0.3.0")

; Byte-indexed prefix/suffix tests; the core ones measure in bytes but slice
; in characters.
Expand Down Expand Up @@ -520,8 +520,7 @@ that cares about a truncated body must check `error` afterwards.")
(when (String.contains-string? &acc "\r\n\r\n")
(set! found true)))))
(Result.Error _) (set! found true)))
(let-do [acc (StringBuf.to-string &sb)]
(StringBuf.delete sb)
(let [acc (StringBuf.into-string sb)]
(let [split-pos (String.index-of-string &acc "\r\n\r\n")]
(if (< split-pos 0)
(Result.Error (ClientError.Receive @"incomplete HTTP headers"))
Expand Down Expand Up @@ -804,8 +803,7 @@ headers first, then either drain the body or hand the stream on.
(match (ResponseStream.poll s)
(Maybe.Nothing) (set! done true)
(Maybe.Just chunk) (StringBuf.append-str &sb &chunk)))
(let-do [body (StringBuf.to-string &sb)]
(StringBuf.delete sb)
(let [body (StringBuf.into-string sb)]
(match @(ResponseStream.error s)
(Maybe.Just e) (Result.Error e)
(Maybe.Nothing) (Result.Success body)))))
Expand Down
4 changes: 1 addition & 3 deletions src/cookie-jar.carp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ if no cookies match. Cookies are serialized longest path first.")
(when (> i 0) (StringBuf.append-str &sb "; "))
(StringBuf.append-str &sb
&(Cookie.kv (Array.unsafe-nth &matched i)))))
(let-do [s (StringBuf.to-string &sb)]
(StringBuf.delete sb)
(Maybe.Just s))))))
(Maybe.Just (StringBuf.into-string sb))))))

(doc apply-to-headers "adds a Cookie header for matching cookies to the
headers map. Returns headers unchanged if no cookies match.")
Expand Down
2 changes: 1 addition & 1 deletion src/multipart.carp
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ without those characters are emitted unchanged.")
(StringBuf.append-str &sb boundary)
(StringBuf.append-str &sb "--")
(StringBuf.append-crlf &sb)
(let-do [result (StringBuf.to-string &sb)] (StringBuf.delete sb) result))))
(StringBuf.into-string sb))))
Loading