1
0
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:
Turiiya
2023-05-12 08:31:27 +02:00
committed by GitHub
parent 790afbce94
commit 67e3061ea1
12 changed files with 27 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -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