vlib: fix warnings due to the vfmt change
							parent
							
								
									8d88b73512
								
							
						
					
					
						commit
						aad122334b
					
				|  | @ -26,7 +26,7 @@ pub fn validate(data byteptr, len int) bool { | ||||||
| 	return !state.failed && state.subindex <= 0 | 	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 || (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) { | 		if (s.subindex == 0 && r0) || (s.subindex == 1 && r1) || (s.subindex == 2 && is_tail) { | ||||||
| 			s.subindex++ | 			s.subindex++ | ||||||
|  |  | ||||||
|  | @ -33,18 +33,14 @@ fn (mut ws Client) handshake() ? { | ||||||
| 	ws.debug_log('sending handshake: $handshake') | 	ws.debug_log('sending handshake: $handshake') | ||||||
| 	ws.socket_write(handshake_bytes) ? | 	ws.socket_write(handshake_bytes) ? | ||||||
| 	ws.read_handshake(seckey) ? | 	ws.read_handshake(seckey) ? | ||||||
| 	unsafe { | 	unsafe {handshake_bytes.free()} | ||||||
| 		handshake_bytes.free() |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // handshake manage the handshake part of connecting
 | // handshake manage the handshake part of connecting
 | ||||||
| fn (mut s Server) handle_server_handshake(mut c Client) ?(string, &ServerClient) { | fn (mut s Server) handle_server_handshake(mut c Client) ?(string, &ServerClient) { | ||||||
| 	msg := c.read_handshake_str() ? | 	msg := c.read_handshake_str() ? | ||||||
| 	handshake_response, client := s.parse_client_handshake(msg, mut c) ? | 	handshake_response, client := s.parse_client_handshake(msg, mut c) ? | ||||||
| 	unsafe { | 	unsafe {msg.free()} | ||||||
| 		msg.free() |  | ||||||
| 	} |  | ||||||
| 	return handshake_response, client | 	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
 | 				// We ignore other headers like protocol for now
 | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		unsafe { | 		unsafe {keys.free()} | ||||||
| 			keys.free() |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	if flags.len < 3 { | 	if flags.len < 3 { | ||||||
| 		return error('invalid client handshake, $client_handshake') | 		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) ? { | fn (mut ws Client) read_handshake(seckey string) ? { | ||||||
| 	mut msg := ws.read_handshake_str() ? | 	mut msg := ws.read_handshake_str() ? | ||||||
| 	ws.check_handshake_response(msg, seckey) ? | 	ws.check_handshake_response(msg, seckey) ? | ||||||
| 	unsafe { | 	unsafe {msg.free()} | ||||||
| 		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') | 	ws.debug_log('handshake response:\n$handshake_response') | ||||||
| 	lines := handshake_response.split_into_lines() | 	lines := handshake_response.split_into_lines() | ||||||
| 	header := lines[0] | 	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.') | 					return error('handshake_handler: Sec-WebSocket-Accept header does not match computed sha1/base64 response.') | ||||||
| 				} | 				} | ||||||
| 				ws.flags << .has_accept | 				ws.flags << .has_accept | ||||||
| 				unsafe { | 				unsafe {challenge.free()} | ||||||
| 					challenge.free() |  | ||||||
| 				} |  | ||||||
| 			} | 			} | ||||||
| 			else {} | 			else {} | ||||||
| 		} | 		} | ||||||
| 		unsafe { | 		unsafe {keys.free()} | ||||||
| 			keys.free() |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	unsafe { |  | ||||||
| 		lines.free() |  | ||||||
| 	} | 	} | ||||||
|  | 	unsafe {lines.free()} | ||||||
| 	if ws.flags.len < 3 { | 	if ws.flags.len < 3 { | ||||||
| 		ws.close(1002, 'invalid websocket HTTP headers') ? | 		ws.close(1002, 'invalid websocket HTTP headers') ? | ||||||
| 		return error('invalid websocket HTTP headers') | 		return error('invalid websocket HTTP headers') | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue