XML RPC changes between 3.7 and 3.9 yield 401 http error

lucas lucas at bourneuf.net
Wed Feb 24 13:11:02 EST 2021


On 24/02/2021 18:48, Chris Angelico wrote:
> On Thu, Feb 25, 2021 at 4:36 AM lucas <lucas at bourneuf.net> wrote:
>>> A properly-formed URL will start with a protocol. I don't know
>>> specifically what changed, but it's looking like something started
>>> rejecting malformed URLs. Try adding "http://" or "https://" to your
>>> URL (whichever is appropriate) and see if both versions will accept
>>> it.
>>>
>>> ChrisA
>>>
>>
>> I did that, obtaining the following URL
>>
>> https://wiki.[…]/lib/exe/xmlrpc.php?u=[…]&p=[…]
>>
>> on my two currently available computer (laptop on 3.9, remote on 3.7),
>> and the results is the same.
>>
>> For information, i'm uploading the same python program to my remote
>> server (debian, 3.7), and running it with the same parameters as my
>> laptop (manjaro, 3.9). My laptop is getting the 401, my server is
>> getting the expected dokuwiki version.
> 
> (I'm aware that you have some other actual domain, but I'll continue
> using "wiki.example.net" as per your original post.)
> 
> Is it possible that there's some kind of server-based restriction?
> What happens if you call socket.gethostbyname("wiki.example.net") on
> both the laptop and the server - do you get back the same IP address?
> (Or use gethostbyname_ex, or possibly getaddrinfo if ipv6 support
> matters.)
> 
> Also, just to make sure there's nothing stupid happening, try printing
> out the URL on both machines. Obviously censor the password before
> sharing it here, but mainly, make sure that the two are generating the
> exact same URL, just in case. Both are running 3.7+, so dict iteration
> order shouldn't be getting in your way, but I've seen crazier things
> before :)
> 
> ChrisA
> 

Thanks for taking time to help me !

I added socket.gethostbyname("wiki.example.net") (i removed the https:// 
since it, obviously now i think about it, led to a socket error)
in the program, so i could verify both the URL and IP are equivalent.

I got the exact same URL and IP. To be sure, i let python run the 
comparison instead of only relying on my eyes.

 >>> 'https://wiki.example.net/lib/exe/xmlrpc.php?u=user&p=password' == 
'https://wiki.example.net/lib/exe/xmlrpc.php?u=user&p=password'
True
 >>> 'xx.xxx.xxx.197' == 'xx.xxx.xxx.197'
True

You gave me an idea: i checked the nginx log of the server hosting the 
dokuwiki instance, and got something of interest :

[SERVER IP] - - [24/Feb/2021:19:08:31 +0100] "POST 
/lib/exe/xmlrpc.php?u=[USER]&p=[PASSWORD] HTTP/1.1" 200 209 "-" 
"Python-xmlrpc/3.7"
[LAPTOP IP] - - [24/Feb/2021:19:08:35 +0100] "POST /lib/exe/xmlrpc.php 
HTTP/1.1" 401 433 "-" "Python-xmlrpc/3.9"

It seems that the laptop is not sending the arguments, despite them 
being fed in the python code ?


Now i think about it, my remote server host both the python program into 
3.7, and the dokuwiki. One may think it could be the source of the problem.
To prove it's not, i will test with another laptop (the one under 
windows, python 3.7, which successfully accessed the wiki while i was 
discovering the error on my manjaro laptop) as soon as possible.

--lucas


More information about the Python-list mailing list