mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: fix typos (#18164)
This commit is contained in:
parent
790afbce94
commit
67e3061ea1
@ -53,7 +53,7 @@ fn C.ntohl(net u32) u32
|
||||
fn C.ntohs(net u16) u16
|
||||
|
||||
// fn C.bind(sockfd int, addr &C.sockaddr, addrlen C.socklen_t) int
|
||||
// use voidptr for arg 2 becasue sockaddr is a generic descriptor for any kind of socket operation,
|
||||
// use voidptr for arg 2 because sockaddr is a generic descriptor for any kind of socket operation,
|
||||
// it can also take sockaddr_in depending on the type of socket used in arg 1
|
||||
fn C.bind(sockfd int, addr &Addr, addrlen u32) int
|
||||
|
||||
|
@ -201,7 +201,7 @@ fn (mut zftp FTP) pasv() !&DTP {
|
||||
println('pass: ${data}')
|
||||
}
|
||||
if code != ftp.passive_mode {
|
||||
return error('pasive mode not allowed')
|
||||
return error('passive mode not allowed')
|
||||
}
|
||||
dtp := new_dtp(data)!
|
||||
return dtp
|
||||
|
@ -1,6 +1,6 @@
|
||||
import net.ftp
|
||||
|
||||
fn test_ftp_cleint() {
|
||||
fn test_ftp_client() {
|
||||
$if !network ? {
|
||||
return
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ pub fn (mut req Request) add_custom_header(key string, val string) ! {
|
||||
return req.header.add_custom(key, val)
|
||||
}
|
||||
|
||||
// do will send the HTTP request and returns `http.Response` as soon as the response is recevied
|
||||
// do will send the HTTP request and returns `http.Response` as soon as the response is received
|
||||
pub fn (req &Request) do() !Response {
|
||||
mut url := urllib.parse(req.url) or { return error('http.Request.do: invalid url ${req.url}') }
|
||||
mut rurl := url
|
||||
|
@ -76,7 +76,7 @@ pub fn (mut s Server) stop() {
|
||||
s.state = .stopped
|
||||
}
|
||||
|
||||
// close immediatly closes the port and signals the server that it has been closed.
|
||||
// close immediately closes the port and signals the server that it has been closed.
|
||||
[inline]
|
||||
pub fn (mut s Server) close() {
|
||||
s.state = .closed
|
||||
|
@ -1,6 +1,6 @@
|
||||
module openssl
|
||||
|
||||
// On Linux, prefer a localy built openssl, because it is
|
||||
// On Linux, prefer a locally built openssl, because it is
|
||||
// much more likely for it to be newer, than the system
|
||||
// openssl from libssl-dev. If there is no local openssl,
|
||||
// the next #pkgconfig flag is harmless, since it will still
|
||||
|
@ -162,7 +162,7 @@ fn (mut c Client) expect_reply(expected ReplyCode) ! {
|
||||
return error('Received unexpected status code ${status}, expecting ${expected}')
|
||||
}
|
||||
} else {
|
||||
return error('Recieved unexpected SMTP data: ${str}')
|
||||
return error('Received unexpected SMTP data: ${str}')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
module net
|
||||
|
||||
pub enum SocketOption {
|
||||
// TODO: SO_ACCEPT_CONN is not here because windows doesnt support it
|
||||
// TODO: SO_ACCEPT_CONN is not here because windows doesn't support it
|
||||
// and there is no easy way to define it
|
||||
broadcast = C.SO_BROADCAST
|
||||
debug = C.SO_DEBUG
|
||||
@ -11,9 +11,9 @@ pub enum SocketOption {
|
||||
linger = C.SO_LINGER
|
||||
oob_inline = C.SO_OOBINLINE
|
||||
reuse_addr = C.SO_REUSEADDR
|
||||
recieve_buf_size = C.SO_RCVBUF
|
||||
recieve_low_size = C.SO_RCVLOWAT
|
||||
recieve_timeout = C.SO_RCVTIMEO
|
||||
receive_buf_size = C.SO_RCVBUF
|
||||
receive_low_size = C.SO_RCVLOWAT
|
||||
receive_timeout = C.SO_RCVTIMEO
|
||||
send_buf_size = C.SO_SNDBUF
|
||||
send_low_size = C.SO_SNDLOWAT
|
||||
send_timeout = C.SO_SNDTIMEO
|
||||
@ -24,9 +24,9 @@ pub enum SocketOption {
|
||||
const (
|
||||
opts_bool = [SocketOption.broadcast, .debug, .dont_route, .error, .keep_alive, .oob_inline]
|
||||
opts_int = [
|
||||
.recieve_buf_size,
|
||||
.recieve_low_size,
|
||||
.recieve_timeout,
|
||||
.receive_buf_size,
|
||||
.receive_low_size,
|
||||
.receive_timeout,
|
||||
.send_buf_size,
|
||||
.send_low_size,
|
||||
.send_timeout,
|
||||
@ -39,9 +39,9 @@ const (
|
||||
.keep_alive,
|
||||
.linger,
|
||||
.oob_inline,
|
||||
.recieve_buf_size,
|
||||
.recieve_low_size,
|
||||
.recieve_timeout,
|
||||
.receive_buf_size,
|
||||
.receive_low_size,
|
||||
.receive_timeout,
|
||||
.send_buf_size,
|
||||
.send_low_size,
|
||||
.send_timeout,
|
||||
|
@ -415,7 +415,7 @@ fn get_scheme(rawurl string) !string {
|
||||
return split[0]
|
||||
}
|
||||
|
||||
// split slices s into two substrings separated by the first occurence of
|
||||
// split slices s into two substrings separated by the first occurrence of
|
||||
// sep. If cutc is true then sep is included with the second substring.
|
||||
// If sep does not occur in s then s and the empty string is returned.
|
||||
fn split(s string, sep u8, cutc bool) (string, string) {
|
||||
|
@ -112,7 +112,7 @@ fn (mut ws Client) read_payload(frame &Frame) ![]u8 {
|
||||
fn (mut ws Client) validate_utf_8(opcode OPCode, payload []u8) ! {
|
||||
if opcode in [.text_frame, .close] && !utf8.validate(payload.data, payload.len) {
|
||||
ws.logger.error('malformed utf8 payload, payload len: (${payload.len})')
|
||||
ws.send_error_event('Recieved malformed utf8.')
|
||||
ws.send_error_event('Received malformed utf8.')
|
||||
ws.close(1007, 'malformed utf8 payload')!
|
||||
return error('malformed utf8 payload')
|
||||
}
|
||||
@ -180,7 +180,7 @@ pub fn (mut ws Client) read_next_message() !Message {
|
||||
return error('none')
|
||||
}
|
||||
|
||||
// payload_from_fragments returs the whole paylaod from fragmented message
|
||||
// payload_from_fragments returns the whole paylaod from fragmented message
|
||||
fn (ws Client) payload_from_fragments(fin_payload []u8) ![]u8 {
|
||||
mut total_size := 0
|
||||
for f in ws.fragments {
|
||||
@ -231,7 +231,7 @@ pub fn (mut ws Client) parse_frame_header() !Frame {
|
||||
frame.opcode = unsafe { OPCode(int(buffer[0] & 0x7F)) }
|
||||
frame.has_mask = (buffer[1] & 0x80) == 0x80
|
||||
frame.payload_len = buffer[1] & 0x7F
|
||||
// if has mask set the byte postition where mask ends
|
||||
// if the frame has a mask, set the byte position where the mask ends
|
||||
if frame.has_mask {
|
||||
mask_end_byte = if frame.payload_len < 126 {
|
||||
websocket.header_len_offset + 4
|
||||
|
@ -18,7 +18,7 @@ fn htonl64(payload_len u64) []u8 {
|
||||
return ret
|
||||
}
|
||||
|
||||
// create_masking_key returs a new masking key to use when masking websocket messages
|
||||
// create_masking_key returns a new masking key to use when masking websocket messages
|
||||
fn create_masking_key() []u8 {
|
||||
mask_bit := rand.u8()
|
||||
buf := []u8{len: 4, init: `0`}
|
||||
@ -26,10 +26,10 @@ fn create_masking_key() []u8 {
|
||||
return buf
|
||||
}
|
||||
|
||||
// create_key_challenge_response creates a key challange response from security key
|
||||
// create_key_challenge_response creates a key challenge response from security key
|
||||
fn create_key_challenge_response(seckey string) !string {
|
||||
if seckey.len == 0 {
|
||||
return error('unexpected seckey lengt zero')
|
||||
return error('unexpected seckey length zero')
|
||||
}
|
||||
guid := '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
|
||||
sha1buf := seckey + guid
|
||||
|
@ -10,7 +10,7 @@ pub mut:
|
||||
nr_closes int
|
||||
}
|
||||
|
||||
// Do not run these tests everytime, since they are flaky.
|
||||
// Do not run these tests every time, since they are flaky.
|
||||
// They have their own specialized CI runner.
|
||||
const github_job = os.getenv('GITHUB_JOB')
|
||||
|
||||
@ -129,10 +129,10 @@ fn ws_test(family net.AddrFamily, uri string) ! {
|
||||
client.write(msg.bytes(), .text_frame) or {
|
||||
panic('fail to write to websocket, err: ${err}')
|
||||
}
|
||||
// sleep to give time to recieve response before send a new one
|
||||
// sleep to give time to receive response before send a new one
|
||||
time.sleep(100 * time.millisecond)
|
||||
}
|
||||
// sleep to give time to recieve response before asserts
|
||||
// sleep to give time to receive response before asserts
|
||||
time.sleep(1500 * time.millisecond)
|
||||
// We expect at least 2 pongs, one sent directly and one indirectly
|
||||
assert test_results.nr_pong_received >= 2
|
||||
|
Loading…
Reference in New Issue
Block a user