in reply to Re: Basic HTTP problems
in thread [SOLVED] Basic HTTP problems

Consider inspecting the actual data that goes over the wire. The tcpdump output does not show the data.

You want to print the request from both programs and compare that. Either create the POST request separately and dump it (using HTTP::Request::Common maybe):

print $req->as_string;

... or add dumping of sent and received data:

$ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return });

I'm sure that Python also has ways to show the data that goes out and comes back in.

Replies are listed 'Best First'.
Re^3: Basic HTTP problems
by Bolemo (Acolyte) on Feb 05, 2021 at 17:10 UTC

    The handlers are so precious advice, thank you!

    It allowed me to discover that the sid has hidden control chars before the 32 chars, so I fixed that.
    BUT that does not fix the issue.

    However after sending the first sid for authentication, the server is sending a cookie with another sid, so I need to probably deal with that. Also, I need to do the same handler trick to the python code, and that will definitively help to solve the problem.

    EDIT: it was the cookies. Adding a cookie jar did the trick!


    Thank you!
Re^3: Basic HTTP problems
by Anonymous Monk on Feb 05, 2021 at 19:27 UTC
    When troubleshooting issues like this, always look at server logs also. Looks like this was an authentication-related issue due to the absence of cookies, and the server will have logged it as such. You really can't tell much from TCPDUMP.

      Yes, this is good advice, when you have access to it.

      In this case, the handler fonctions were exactly what I needed: to know what is being sent and received as tcpdump misses al lot of data as you pointed out.

        If you have access to it wireshark is more intelligent about "common" protocols and can give you a protocol-level dump rather than just stopping at the TCP layer (presuming you're not hitting something over https; but even then I believe that there's ways to proxy around that or use the server's key if you control / have access to that).

        The cake is a lie.
        The cake is a lie.
        The cake is a lie.