Pontus ??stlund wrote:
I think this might work:
Web.Api.Google api = Web.Api.Google(0, 0, 0);
api->auth->get_token_from_jwt(your_service_account_key, 0, lambda (bool ok, string data) { // yadda yadda });
And if I remember correctly, leaving out the lambda will issue a sync call.
Well, something like this does in fact seem to work, however, when doing this without the lambda (and thus blocking and with the sync call) I get a SSL.Connection Fatal alert: Decoding error.
queue_write: To write: 0 [thr:139633112520512,fd:11] queue_write: Got nothing to write (0 bytes buffered) [thr:139633112520512,fd:11] queue_write: Returning 0 (0 bytes buffered) [thr:139633112520512,fd:11] ssl_read_callback: Got 0 bytes of application data [thr:139633112520512,fd:11] Running local backend [r:1 w:0], infinite timeout [thr:139633112520512,fd:11] ssl_read_callback (string[751]): nonblocking mode=0, callback mode=0 handshaking SSL.Connection->recv_packet(): version=0x303 SSL.Connection: received packet of type 22 SSL.Connection: HANDSHAKE SSL.Connection->recv_packet(): version=0x303 SSL.Connection: received packet of type 22 SSL.Connection: HANDSHAKE SSL.Connection->recv_packet(): version=0x303 SSL.Connection: received packet of type 22 SSL.Connection: HANDSHAKE SSL.ClientConnection(handshaking): derive_master_secret: STATE_wait_for_peer (TLS 1.2) SSL.Connection->send_packet: type 22, pri 2, "\20\0\0"!\4" SSL.Connection->send_packet: type 20, pri 2, "\1" SSL.Connection->send_packet: type 22, pri 2, "\24\0\0\f\376C" SSL.Connection->recv_packet(): current_read_state is zero! ssl_read_callback: Got data: "" SSL.Connection: writing packet of type 22, "\20\0\0"!\4\337" queue_write: To write: 2 SSL.Connection: writing packet of type 20, "\1" queue_write: To write: 2 SSL.Connection: writing packet of type 22, "\24\0\0\f\376Cm" queue_write: To write: 2 queue_write: To write: 0 [thr:139633112520512,fd:11] queue_write: Got nothing to write (94 bytes buffered) [thr:139633112520512,fd:11] queue_write: Install the write callback. [thr:139633112520512,fd:11] queue_write: Returning 0 (94 bytes buffered) [thr:139633112520512,fd:11] ssl_read_callback: Got 0 bytes of application data [thr:139633112520512,fd:11] Running local backend [r:1 w:1], infinite timeout [thr:139633112520512,fd:11] ssl_write_callback: nonblocking mode=0, callback mode=0 handshaking [thr:139633112520512,fd:11] ssl_write_callback: Wrote 94 bytes (0 bytes left) queue_write: To write: 0 [thr:139633112520512,fd:11] queue_write: Got nothing to write (0 bytes buffered) [thr:139633112520512,fd:11] queue_write: Returning 0 (0 bytes buffered) [thr:139633112520512,fd:11] Running local backend [r:1 w:0], infinite timeout [thr:139633112520512,fd:11] ssl_read_callback (string[7]): nonblocking mode=0, callback mode=0 handshaking SSL.Connection->recv_packet(): version=0x303 SSL.Connection: received packet of type 21 SSL.Connection: ALERT SSL.Connection: Fatal alert "Decoding error."
I'm a little out of my depth here. Haven't had any need to decode an SSL handshake/connection by RFC yet... Any ideas?
I have not tried the same using async. This is without a backend running. Maybe the problem is in the handling of the local backend for SSL. I could probably come up with a very small sample of code that illustrates the error.
Basically the problem is at the start of the SSL connection, before actual data is exchanged.