mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib: fix warnings due to the vfmt change
This commit is contained in:
parent
8d88b73512
commit
aad122334b
@ -26,7 +26,7 @@ pub fn validate(data byteptr, len int) bool {
|
||||
return !state.failed && state.subindex <= 0
|
||||
}
|
||||
|
||||
fn (mut s Utf8State) seq(r0, r1, is_tail bool) bool {
|
||||
fn (mut s Utf8State) seq(r0 bool, r1 bool, is_tail bool) bool {
|
||||
if s.subindex == 0 || (s.index > 1 && s.subindex == 1) || (s.index >= 6 && s.subindex == 2) {
|
||||
if (s.subindex == 0 && r0) || (s.subindex == 1 && r1) || (s.subindex == 2 && is_tail) {
|
||||
s.subindex++
|
||||
|
@ -33,18 +33,14 @@ fn (mut ws Client) handshake() ? {
|
||||
ws.debug_log('sending handshake: $handshake')
|
||||
ws.socket_write(handshake_bytes) ?
|
||||
ws.read_handshake(seckey) ?
|
||||
unsafe {
|
||||
handshake_bytes.free()
|
||||
}
|
||||
unsafe {handshake_bytes.free()}
|
||||
}
|
||||
|
||||
// handshake manage the handshake part of connecting
|
||||
fn (mut s Server) handle_server_handshake(mut c Client) ?(string, &ServerClient) {
|
||||
msg := c.read_handshake_str() ?
|
||||
handshake_response, client := s.parse_client_handshake(msg, mut c) ?
|
||||
unsafe {
|
||||
msg.free()
|
||||
}
|
||||
unsafe {msg.free()}
|
||||
return handshake_response, client
|
||||
}
|
||||
|
||||
@ -88,9 +84,7 @@ fn (mut s Server) parse_client_handshake(client_handshake string, mut c Client)
|
||||
// We ignore other headers like protocol for now
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
keys.free()
|
||||
}
|
||||
unsafe {keys.free()}
|
||||
}
|
||||
if flags.len < 3 {
|
||||
return error('invalid client handshake, $client_handshake')
|
||||
@ -136,12 +130,10 @@ fn (mut ws Client) read_handshake_str() ?string {
|
||||
fn (mut ws Client) read_handshake(seckey string) ? {
|
||||
mut msg := ws.read_handshake_str() ?
|
||||
ws.check_handshake_response(msg, seckey) ?
|
||||
unsafe {
|
||||
msg.free()
|
||||
}
|
||||
unsafe {msg.free()}
|
||||
}
|
||||
|
||||
fn (mut ws Client) check_handshake_response(handshake_response, seckey string) ? {
|
||||
fn (mut ws Client) check_handshake_response(handshake_response string, seckey string) ? {
|
||||
ws.debug_log('handshake response:\n$handshake_response')
|
||||
lines := handshake_response.split_into_lines()
|
||||
header := lines[0]
|
||||
@ -168,19 +160,13 @@ fn (mut ws Client) check_handshake_response(handshake_response, seckey string) ?
|
||||
return error('handshake_handler: Sec-WebSocket-Accept header does not match computed sha1/base64 response.')
|
||||
}
|
||||
ws.flags << .has_accept
|
||||
unsafe {
|
||||
challenge.free()
|
||||
}
|
||||
unsafe {challenge.free()}
|
||||
}
|
||||
else {}
|
||||
}
|
||||
unsafe {
|
||||
keys.free()
|
||||
}
|
||||
}
|
||||
unsafe {
|
||||
lines.free()
|
||||
unsafe {keys.free()}
|
||||
}
|
||||
unsafe {lines.free()}
|
||||
if ws.flags.len < 3 {
|
||||
ws.close(1002, 'invalid websocket HTTP headers') ?
|
||||
return error('invalid websocket HTTP headers')
|
||||
|
Loading…
Reference in New Issue
Block a user