[exim-dev] [Bug 2784] readsocket doesn't work as expected

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: admin
Data:  
Para: exim-dev
Temas antigos: [exim-dev] [Bug 2784] New: readsocket doesn't work as expected
Asunto: [exim-dev] [Bug 2784] readsocket doesn't work as expected
https://bugs.exim.org/show_bug.cgi?id=2784

--- Comment #9 from Lena <Lena@???> ---
Created attachment 1403
--> https://bugs.exim.org/attachment.cgi?id=1403&action=edit
revert wb

In both cases shutdown=yes and shutdown=no, after sending the data, Exim 4.94.2
sends an additional packet with flag F and length 0. Telnet doesn't send such
packet.

Exim 4.93 expand.c :

        /* Now we need to read from the socket, under a timeout. The function
        that reads a file can be used. */


    if (!do_tls)
      fp = fdopen(cctx.sock, "rb");


Exim 4.94 lookups/readsock.c :

/* Now we need to read from the socket, under a timeout. The function
that reads a file can be used. If we're using a stdio buffered read,
and might need later write ops on the socket, the stdio must be in
writable mode or the underlying socket goes non-writable. */

if (!cctx->tls_ctx)
fp = fdopen(cctx->sock, lf.do_shutdown ? "rb" : "wb");


Can someone explain when/how/why we might need later write ops on the socket
(after the data from the second argument of "${readsocket" was sent)?

Exim 4.94.2 - doesn't work:

[root@lena ~]# exim -be '${readsocket{inet:i.ua:80}{GET / HTTP/1.0\r\nHost:
i.ua\r\n\r\n}{4s:shutdown=yes}{\n}{socket failure}}'

[root@lena ~]# exim -be '${readsocket{inet:i.ua:80}{GET / HTTP/1.0\r\nHost:
i.ua\r\n\r\n}{4s:shutdown=no}{\n}{socket failure}}'

[root@lena ~]#

After I reverted this change (patch attached), it works:

[root@lena ~]# exim -be '${readsocket{inet:i.ua:80}{GET / HTTP/1.0\r\nHost:
i.ua\r\n\r\n}{4s:shutdown=yes}{\n}{socket failure}}'

[root@lena ~]# exim -be '${readsocket{inet:i.ua:80}{GET / HTTP/1.0\r\nHost:
i.ua\r\n\r\n}{4s:shutdown=no}{\n}{socket failure}}'
HTTP/1.1 301 Moved Permanently
Date: Mon, 22 Nov 2021 13:13:56 GMT
Server: Apache/1.3.42 (Unix) mod_deflate/1.0.21
Location: https://www.i.ua
Connection: close
Content-Type: text/html; charset=windows-1251


[root@lena ~]#

--
You are receiving this mail because:
You are on the CC list for the bug.