Skip to content

Commit 4679b39

Browse files
authored
Merge pull request #267 from thomas-huegel/main
Allow TCP to send null-terminated buffers
2 parents b7b81a8 + 533938a commit 4679b39

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

lightbug_http/connection.mojo

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ struct TCPConnection(Connection):
159159
raise Error("TCPConnection.read: Failed to read data from connection.")
160160

161161
fn write(self, buf: Span[Byte]) raises -> Int:
162-
if buf[-1] == 0:
163-
raise Error("TCPConnection.write: Buffer must not be null-terminated.")
164-
165162
try:
166163
return self.socket.send(buf)
167164
except e:

lightbug_http/socket.mojo

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,6 @@ struct Socket[AddrType: Addr & ImplicitlyCopyable, address_family: AddressFamily
441441
self._remote_address = AddrType(remote[0], remote[1])
442442

443443
fn send(self, buffer: Span[Byte]) raises -> Int:
444-
if buffer[-1] == 0:
445-
raise Error("Socket.send: Buffer must not be null-terminated.")
446-
447444
try:
448445
return send(self.fd, buffer.unsafe_ptr(), len(buffer), 0)
449446
except e:

0 commit comments

Comments
 (0)