Skip to content

timing in 23connect.t #7

@e477

Description

@e477

23connect.t exposes an interesting timing issue. The proxy accepts the CONNECT and the 'is' in line 69 passes, but then reading from the socket in line 76 returns 'undef' and the test fails. However, the test passes when I try to monitor its behaviour with tcpdump.

With logging enabled:

t/23connect.t ............. 
[Fri May  1 03:11:08 2015] (6858) PROCESS: Forked child process 6859
[Fri May  1 03:11:08 2015] (6859) SOCKET: New connection from 127.0.0.1:47405
[Fri May  1 03:11:08 2015] (6859) REQUEST: CONNECT localhost:59128
[Fri May  1 03:11:08 2015] (6859) REQUEST: Via: 1.1 earl:0 (HTTP::Proxy/0.303)
[Fri May  1 03:11:08 2015] (6859) REQUEST: Host: localhost:59128
[Fri May  1 03:11:08 2015] (6859) REQUEST: User-Agent: libwww-perl/6.13
[Fri May  1 03:11:08 2015] (6859) REQUEST: X-Forwarded-For: 127.0.0.1
t/23connect.t ............. 1/4 
#   Failed test 'Read some data from the socket'
#   at t/23connect.t line 80. 
#   Failed test 'CONNECTed to the TCP server and got the banner'
#   at t/23connect.t line 81. 
#          got: undef
#     expected: 'President_of_Earth Barbarella Professor_Ping Stomoxys Dildano
# ' 
[Fri May  1 03:11:08 2015] (6859) RESPONSE: 200 OK
[Fri May  1 03:11:08 2015] (6859) RESPONSE: Date: Fri, 01 May 2015 01:11:08 GMT 
[Fri May  1 03:11:08 2015] (6859) RESPONSE: Transfer-Encoding: chunked
[Fri May  1 03:11:08 2015] (6859) RESPONSE: Server: HTTP::Proxy/0.303
[Fri May  1 03:11:08 2015] (6859) CONNECT: Connection closed by the client
[Fri May  1 03:11:08 2015] (6859) PROCESS: Served 1 requests
[Fri May  1 03:11:08 2015] (6859) CONNECT: Read undef from server (Bad file descriptor)
[Fri May  1 03:11:08 2015] (6859) CONNECT: End of CONNECT proxyfication
[Fri May  1 03:11:09 2015] (6858) PROCESS: Reaped child process 6859
[Fri May  1 03:11:09 2015] (6858) PROCESS: 0 remaining kids: 
[Fri May  1 03:11:09 2015] (6858) STATUS: Processed 1 connection(s)
t/23connect.t ............. Failed 2/4 subtests 

With logging enabled and tcpdump running in the background:

t/23connect.t ............. 
[Fri May  1 03:13:55 2015] (6943) PROCESS: Forked child process 6944
[Fri May  1 03:13:55 2015] (6944) SOCKET: New connection from 127.0.0.1:49532
[Fri May  1 03:13:55 2015] (6944) REQUEST: CONNECT localhost:55409
[Fri May  1 03:13:55 2015] (6944) REQUEST: Via: 1.1 earl:0 (HTTP::Proxy/0.303)
[Fri May  1 03:13:55 2015] (6944) REQUEST: Host: localhost:55409
[Fri May  1 03:13:55 2015] (6944) REQUEST: User-Agent: libwww-perl/6.13
[Fri May  1 03:13:55 2015] (6944) REQUEST: X-Forwarded-For: 127.0.0.1
[Fri May  1 03:13:55 2015] (6944) RESPONSE: 200 OK
[Fri May  1 03:13:55 2015] (6944) RESPONSE: Date: Fri, 01 May 2015 01:13:55 GMT
[Fri May  1 03:13:55 2015] (6944) RESPONSE: Transfer-Encoding: chunked
[Fri May  1 03:13:55 2015] (6944) RESPONSE: Server: HTTP::Proxy/0.303
[Fri May  1 03:13:55 2015] (6944) CONNECT: 62 bytes received from server
t/23connect.t ............. 1/4 
[Fri May  1 03:13:55 2015] (6944) CONNECT: Connection closed by the client
[Fri May  1 03:13:55 2015] (6944) PROCESS: Served 1 requests
[Fri May  1 03:13:55 2015] (6944) CONNECT: End of CONNECT proxyfication
t/23connect.t ............. 4/4 
[Fri May  1 03:13:56 2015] (6943) PROCESS: Reaped child process 6944
[Fri May  1 03:13:56 2015] (6943) PROCESS: 0 remaining kids:
[Fri May  1 03:13:56 2015] (6943) STATUS: Processed 1 connection(s)
t/23connect.t ............. ok

Could this be the result of the client trying to read from the proxy before the proxy has connected to or read from the server?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions