in reply to Re^2: CGI - Not getting POST Variables
in thread CGI - Not getting POST Variables

It sounds to me like the problem's in the C++ web client, not the perl backend. You might want to sniff the connection, and see exactly what the client is sending, as it doesn't seem to be serializing the values correctly. (or it's using some sort of encoding that I'm not familiar with, and the perl script doesn't understand)

Replies are listed 'Best First'.
Re^4: CGI - Not getting POST Variables
by jdtoronto (Prior) on Aug 03, 2006 at 16:17 UTC
    Header compression would certainly seem a logical culprit, I would try something like ethereal to sniff what is actually being sent by the client.

    jdtoronto

      Hi

      I do not have enough rights to install ethereal or tcpdump in the server :(

      By the way, I tried to print the STDIN value using the code

      read (STDIN, $form_info, $size_of_form_info); print TMP $form_info ;

      Here is its output:

      --AaB03x Content-Disposition: form-data; name='userfile'; filename='MofTestFil. +jpg' Content-Type: application/octet-stream Content-Transfer-Encoding: base64 ��JFIFHH�C ▒▒�C !2"� �}!1AQa"q#BR�$3br ▒▒%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�&#6 +5533;�������� +��������&#655 +33; �w!1AQaq"B #3Rbr $4�▒▒&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz&#6 +5533;�������� +��������&#655 +33; ?S(( +(((((((((( --AaB03x Content-Disposition: form-data; name='accemailid' --AaB03x Content-Disposition: form-data; name='comment' --AaB03x Content-Disposition: form-data; name='tag' --AaB03x Content-Disposition: form-data; name='privacy' Public --AaB03x--

      You can see that all the other form-data fields are empty! The whole values is in the first field! Any idea?

      Thanks
      Srikanth

        Your browser or html is broken
Re^4: CGI - Not getting POST Variables
by vi_srikanth (Acolyte) on Aug 03, 2006 at 13:52 UTC
    If there is problem with C++ web client, then the PHP script should also NOT work... right? But, it is working perfectly!!!

      Try to sniff the connection -- there's something different going on in the encoding the web browser is using for the HTML form, and the the C++ client send. It may be really subtle, too -- the server might send a different Accept header when it's a PHP script, which generates different behaviour in the C++ program.

      So, I'll repeat myself -- sniff the connection. Something different is going on, or it wouldn't be broken. Look for what's different, and it can be a clue in what needs to be fixed, and how to fix it. Debugging problems is more than just looking at symptoms and surface effects -- you need to dig into why something is happening, not just what is happening.

      The only thing I can think of right now is that the server is sending headers that it accepts some sort of compression, or a language encoding that I'm not familiar with, but without knowing what's being sent between the two systems, I don't want to make a false diagnosis. (would you want a doctor to just glance at you for a few seconds, then tell you that you need to have a major organ internal removed?)

      (and, if you come away with learning how to trouble shoot these sorts of things, you don't have to come back and ask every time ... and might be able to help others, too.)