Problem Sending Authenticate over HTSP
Added by Jeremy Bush about 12 years ago
After chatting with @adamsutten over IRC, I'm posting this here.
I'm writing a ruby HTSP client. Got the message decoding and encoding working, and hello working.
However, I seem to be having problems sending an Authenticate message. I get back a `noaccess =>1` error.
Here's some debug output from my test script:
"Sending: \x00\x00\x008\x02\v\x00\x00\x00\x01htspversion\x06\x03\n\x00\x00\x00\x05clientnamerspec\x03\x06\x00\x00\x00\x05methodhello" #<HTSP::Message:0x007f899d1eac48 @params={"htspversion"=>6, "servername"=>"HTS Tvheadend", "serverversion"=>"3.1.769~g4303374", "challenge"=>"\x13\xB3s\xBC\xC3*Bc \xDA\xA02\xE4\xB9u\xE8\x97D\x15\xD5Ny\xAFM\xE0(i\xB2\x91\xC8\xA6&", "servercapability"=>{}}> "Sending: \x00\x00\x00P\x03\b\x00\x00\x00\nusernamejeremybush\x03\x06\x00\x00\x00\x14digest\x82k_\xE2b\x9E\xA2\x89\xE1\xA7\xA3h\x87Z\x82yD\x1C\x8E\b\x03\x06\x00\x00\x00\fmethodauthenticate" F Failures: 1) HTSP::Client authenticate successfully authenticates Failure/Error: response = subject.authenticate('jeremybush', 'zombor') RuntimeError: Authentication failed! # ./lib/htsp/client.rb:33:in `authenticate' # ./spec/htsp/client_spec.rb:22:in `block (3 levels) in <top (required)>' Finished in 0.00942 seconds 1 example, 1 failure
Here you can see the hello method, the response, and then the authenticate method.
I compared my digest code to adamsutton's python code, and it seems to match up. I'm not sure what I'm doing wrong at this point, as I've banged on this for a few hours now.
The complete code for the project is located at https://github.com/zombor/htsp-ruby
Replies (2)
RE: Problem Sending Authenticate over HTSP - Added by Jeremy Bush about 12 years ago
After some debugging in htsp.c, it seems that I'm getting HTSMSG_ERR_CONVERSION_IMPOSSIBLE. Still digging on why this is though, it appears I am sending a binary string.
RE: Problem Sending Authenticate over HTSP - Added by Jeremy Bush about 12 years ago
So stupid
I was sending the wrong field type.