Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: LWP: transfer from Python to Perl

by hippo (Bishop)
on Jan 10, 2018 at 18:11 UTC ( [id://1207084]=note: print w/replies, xml ) Need Help??


in reply to Re^3: LWP: transfer from Python to Perl
in thread LWP: transfer from Python to Perl

This confirms what I suspected in my previous post - namely that you have not set the Content-Type header. Most web servers will depend on this to be set correctly in the requests they receive.

Replies are listed 'Best First'.
Re^5: LWP: transfer from Python to Perl
by Anonymous Monk on Jan 10, 2018 at 20:02 UTC
    Thanks hippo

    I added $request->content_type('application/x-www-form-urlencoded'); and some other minor things, but still error 500. The only difference (what I can see now) is now:

    User-Agent: Python-urllib/3.6 Connection: close TE: deflate,gzip;q=0.3 Connection: close,TE User-Agent: libwww-perl/6.26
    Can this be the reason? How can I influence TE and Connection ? I added

    ${${$request}{'_headers'}}{'Connection'}='close';</p><p>
    but than Connection changed from :

    Connection: TE,close to Connection: close,TE

      Those should both be irrelevant from the server's point of view in terms of the successful processing of the request. See the RFC section for detail about the specific headers if interested.

      If you are happy with the request as it stands then I suggest you contact whoever runs the server, send them the dump of your request, the response, your client IP address and the timestamp and ask them why it isn't succeeding.

        Thanks a lot hippo for your patience and your help !!!!!!!!!

        I just could solve my issue now!

        It seems that the server checked some information which was sent with the previous get. In python the get and the following post were done with the same agent. In perl I used LWP::Simple for the get and LWP::UserAgent; for the POST. This I was changing now and now it works. (Or I changed something which I am not aware by doing this change. The GET sent before the POST is now for sure different, in the response I see no difference between the two versions)

        But without your help I would not have manged (at least not in this short time) to get the POST done fully in the needed way.

        Thanks a lot !!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1207084]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-03-28 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found