<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>48143</bug_id>
          
          <creation_ts>2023-10-24 17:01:37 +0300</creation_ts>
          <short_desc>Использует сначала IPv6 при разрешении localhost</short_desc>
          <delta_ts>2023-10-25 10:09:55 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>curl</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Evgeny Shesteperov">alimektor</reporter>
          <assigned_to name="Anton Farygin">rider</assigned_to>
          <cc>glebfm</cc>
    
    <cc>ldv</cc>
    
    <cc>rider</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>235491</commentid>
    <comment_count>0</comment_count>
    <who name="Evgeny Shesteperov">alimektor</who>
    <bug_when>2023-10-24 17:01:37 +0300</bug_when>
    <thetext>Версия

-   Воспроизводится, начиная с версии curl-8.3.0-alt1

Шаги воспроизведения

    apt-get install -y curl apache2-base apache2-cgi-bin apache2-cgi-bin-printenv apache2-cgi-bin-test-cgi apache2-mod_ssl

    a2enmod cgi
    a2ensite default
    a2ensite default_https
    a2enmod ssl
    a2enport https

    cat &gt; /etc/httpd2/conf/sites-enabled/000-default_https.conf &lt;&lt;EOF
    &lt;IfModule ssl_module&gt;
            &lt;VirtualHost _default_:443&gt;
                    DocumentRoot &quot;/var/www/html&quot;
                    ServerName www.example.com:443
                    ServerAdmin webmaster@example.com
                    ErrorLog &quot;/var/log/httpd2/error_log&quot;
                    TransferLog &quot;/var/log/httpd2/access_log&quot;
                    SSLEngine on
                    SSLProtocol all -SSLv2
                    SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
                    SSLCertificateFile &quot;/var/lib/ssl/certs/httpd2.cert&quot;
                    SSLCertificateKeyFile &quot;/var/lib/ssl/private/httpd2.key&quot;
                    &lt;FilesMatch &quot;\.(cgi|shtml|phtml|php)$&quot;&gt;
                            SSLOptions +StdEnvVars
                    &lt;/FilesMatch&gt;
                    &lt;Directory &quot;/var/www/cgi-bin&quot;&gt;
                            SSLOptions +StdEnvVars
                    &lt;/Directory&gt;
                    &lt;IfModule setenvif_module&gt;
                            BrowserMatch &quot;MSIE [2-5]&quot; \
                                    nokeepalive ssl-unclean-shutdown \
                                    downgrade-1.0 force-response-1.0
                    &lt;/IfModule&gt;
                    &lt;IfModule log_config_module&gt;
                            CustomLog &quot;/var/log/httpd2/ssl_request_log&quot; \
                                      &quot;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \&quot;%r\&quot; %b&quot;
                    &lt;/IfModule&gt;
                    &lt;IfModule alias_module&gt;
                            ScriptAlias /cgi-bin/ &quot;/var/www/cgi-bin/&quot;
                    &lt;/IfModule&gt;
            &lt;/VirtualHost&gt;
    &lt;/IfModule&gt;
    EOF

    systemctl restart httpd2

    chmod 755 /var/www/cgi-bin/printenv
    chmod 755 /var/www/cgi-bin/test-cgi

    (echo -e &apos;#!/bin/sh\nhttp://localhost/cgi-bin/test-cgi&apos;; cat /var/www/cgi-bin/test-cgi) | sponge /var/www/cgi-bin/test-cgi

    curl -skv https://localhost/cgi-bin/printenv 2&gt;/dev/null | grep REMOTE_ADDR

Ожидаемый результат: REMOTE_ADDR=&quot;127.0.0.1&quot;

Фактический результат: REMOTE_ADDR=&quot;::1&quot;

Похожие ошибки:

-   https://github.com/curl/curl/pull/12136 - asyn-thread: don’t use
    PF_INET6 for getaddrinfo on Windows

Не воспроизводится, версии:

-   curl-8.1.0-alt2
-   libcurl-8.1.0-alt2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>235546</commentid>
    <comment_count>1</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2023-10-25 10:09:55 +0300</bug_when>
    <thetext>не вижу ошибки - если у вас настроено ipv6 и имя резолвится, надо пробовать ipv6 а затем ipv4:
$ curl -skv https://localhost/
*   Trying [::1]:443...
* connect to ::1 port 443 failed: В соединении отказано
*   Trying 127.0.0.1:443...
* connect to 127.0.0.1 port 443 failed: В соединении отказано
* Failed to connect to localhost port 443 after 0 ms: Couldn&apos;t connect to server
* Closing connection</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>