-
Notifications
You must be signed in to change notification settings - Fork 77
Closed
Description
我在获取 user_agent
的时候使用的 unwrap_or_default
let ua = request.user_agent().unwrap_or_default();
当客户端请求的 UA 为空时,子进程会直接崩溃重启。
let str: &NgxStr = Default::default();
println!("{:?}", str.as_bytes());
做了测试,NgxStr
default 调用 as_bytes
方法会报错:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
Metadata
Metadata
Assignees
Labels
No labels