Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl reports "fault filter abortcurl: (6) Could not resolve host: store.example.xn--com-9o0a" #13214

Closed
sanjaypujare opened this issue Mar 28, 2024 · 4 comments

Comments

@sanjaypujare
Copy link

sanjaypujare commented Mar 28, 2024

I did this

From a Google doc I copy-pasted a curl command that was:

curl -i 10.1.2.9 -H “host: store.example.com”

Note that what appear as double-quotes around host: store.example.com are not the normal double-quotes used in computing but used in Document editing programs like GoogleDoc or Word. But this trips up curl and it gives me the following output:

HTTP/1.1 404 Not Found
content-length: 18
content-type: text/plain
date: Thu, 28 Mar 2024 05:04:59 GMT
via: 1.1 google

fault filter abortcurl: (6) Could not resolve host: store.example.xn--com-9o0a

I spent considerable amount of time trying to troubleshoot this since the error message was very misleading

I expected the following

curl should probably recognize the unsupported characters on the command line and generate a message while parsing those arguments instead of generating an error deep inside (which is what "fault filter abort" looks like)

curl/libcurl version

curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.11 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3 OpenLDAP/2.5.13
Release-Date: 2023-02-20, security patched: 7.88.1-10+deb12u5
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

operating system

Linux xxxxx 6.1.0-18-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux

@bagder
Copy link
Member

bagder commented Mar 28, 2024

The fault filter abort text is not from curl, it is body content from the server.

@bagder
Copy link
Member

bagder commented Mar 28, 2024

This case is really a matter of "garbage in, garbage out". It is difficult for curl to know when the garbage input is intended or not.

bagder added a commit that referenced this issue Mar 28, 2024
... in the option argument.

Typically this is a mistake done when copying example command lines from
online documentation using the wrong quote character.

Presumably there are also other potential quote characters that might be
used, and this check is done without even knowing that unicode is used!

Reported-by: Sanjay Pujare
Fixes #13214
@sanjaypujare
Copy link
Author

I understand. Thanks for fixing it. One more thing that confused me. With the bad unicode character(s) and with -v option I see:

curl -v -i 10.1.2.9 -H “host: store.example.com”
*   Trying 10.1.2.9:80...
* Connected to 10.1.2.9 (10.1.2.9) port 80 (#0)
> GET / HTTP/1.1
> Host: 10.1.2.9
> User-Agent: curl/7.88.1
> Accept: */*
> 
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< content-length: 18
content-length: 18
< content-type: text/plain
content-type: text/plain
< date: Thu, 28 Mar 2024 20:12:14 GMT
date: Thu, 28 Mar 2024 20:12:14 GMT
< via: 1.1 google
via: 1.1 google

< 
* Connection #0 to host 10.1.2.9 left intact
fault filter abort* Could not resolve host: store.example.xn--com-9o0a
* Closing connection 1
curl: (6) Could not resolve host: store.example.xn--com-9o0a

But with the right quote character(s):

curl -v -i 10.1.2.9 -H "host: store.example.com"
*   Trying 10.1.2.9:80...
* Connected to 10.1.2.9 (10.1.2.9) port 80 (#0)
> GET / HTTP/1.1
> Host: store.example.com
> User-Agent: curl/7.88.1
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< date: Thu, 28 Mar 2024 20:12:39 GMT
date: Thu, 28 Mar 2024 20:12:39 GMT
< via: 1.1 google
via: 1.1 google
< content-length: 0
content-length: 0

< 
* Connection #0 to host 10.1.2.9 left intact

The 401 Unauthorized is expected in the second example. But the questions are:

  • who is generating the error "Could not resolve host: store.example.xn--com-9o0a" in the first case? It looks like curl didn't send any of this stuff to the server so it must have been from curl itself
  • because of the -H argument curl should have treated the following argument only as header content to be included in the request. But for some reason it treated the whole string “host: store.example.com” as a hostname to be resolved. Is that correct?

@dfandrich
Copy link
Contributor

dfandrich commented Mar 28, 2024 via email

bagder added a commit that referenced this issue Mar 30, 2024
... in the option argument.

Typically this is a mistake done when copying example command lines from
online documentation using the wrong quote character.

Presumably there are also other potential quote characters that might be
used, and this check is done without even knowing that unicode is used!

Reported-by: Sanjay Pujare
Fixes #13214
@bagder bagder closed this as completed in 94db8e5 Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants