gpt4 book ai didi

linux - wget 的 strace 给出了奇怪的套接字调用

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:18:37 25 4
gpt4 key购买 nike

“strace wget grooveshark.com”因字符串长度错误的奇怪套接字调用而停止,我必须按 Ctrl+C 才能终止。

write(2, "Connecting to grooveshark.com (g"..., 67Connecting to grooveshark.com (grooveshark.com)|8.20.213.76|:80... ) = 67
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("8.20.213.76")}, 16) = 0
write(2, "connected.\n", 11connected.
) = 11
select(4, NULL, [3], NULL, {900, 0}) = 1 (out [3], left {899, 999993})
write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget"..., 115) = 115
write(2, "HTTP request sent, awaiting resp"..., 40HTTP request sent, awaiting response... ) = 40 [[ Check this line ]]
select(4, [3], NULL, NULL, {900, 0} ^C

write(2, "HTTP 请求已发送,等待响应"..., 40HTTP 请求已发送,正在等待响应...) = 40

应该是

write(2, "HTTP 请求已发送,正在等待响应...", 40 ) = 40

但是 strace wget google.com 给出了

write(3, "GET / HTTP/1.1\r\nUser-Agent: Wget"..., 116) = 116
write(2, "HTTP request sent, awaiting resp"..., 40) = 40
select(4, [3], NULL, NULL, {900, 0}) = 1 (in [3], left {899, 932611})

并正确终止。

谢谢

最佳答案

您看到 wget 的输出与 strace 的输出混合在一起。使用 strace 的 -o 选项将跟踪存储在文件中,这样就不会发生这种情况。

write(2, "HTTP request sent, awaiting resp"..., 40HTTP request sent, awaiting response... ) = 40

wget 中的 write 调用将消息打印到 stderr,在它返回之前,它的输出在终端中看到,在 40 和右括号之间

关于linux - wget 的 strace 给出了奇怪的套接字调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11010018/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com