1- from memory import UnsafePointer
1+ from memory import UnsafePointer, Span
22from collections import Optional
33from sys.ffi import external_call, OpaquePointer
44from lightbug_http.strings import to_string
5+ from lightbug_http.io.bytes import ByteView
6+ from lightbug_http._logger import logger
7+ from lightbug_http.socket import Socket
58from lightbug_http._libc import (
69 c_int,
710 c_char,
@@ -20,8 +23,6 @@ from lightbug_http._libc import (
2023 INET_ADDRSTRLEN ,
2124 INET6_ADDRSTRLEN ,
2225)
23- from lightbug_http._logger import logger
24- from lightbug_http.socket import Socket
2526
2627alias MAX_PORT = 65535
2728alias MIN_PORT = 0
@@ -394,24 +395,24 @@ fn resolve_localhost(host: String, network: NetworkType) -> String:
394395
395396 return host
396397
397- fn parse_ipv6_bracketed_address (address : String ) raises -> (String , UInt16):
398+ fn parse_ipv6_bracketed_address (address : ByteView[ImmutableAnyOrigin] ) raises -> (ByteView[ImmutableAnyOrigin] , UInt16):
398399 """ Parse an IPv6 address enclosed in brackets.
399400
400401 Returns:
401402 Tuple of (host, colon_index_offset)
402403 """
403- if address[0 ] != " [" :
404+ if address[0 ] != Byte( ord ( " [" )) :
404405 return address, UInt16(0 )
405406
406- var end_bracket_index = address.find(" ]" )
407+ var end_bracket_index = address.find(Byte( ord ( " ]" )) )
407408 if end_bracket_index == - 1 :
408409 raise Error(" missing ']' in address" )
409410
410411 if end_bracket_index + 1 == len (address):
411412 raise MissingPortError
412413
413414 var colon_index = end_bracket_index + 1
414- if address[colon_index] != " :" :
415+ if address[colon_index] != Byte( ord ( " :" )) :
415416 raise MissingPortError
416417
417418 return (
0 commit comments