src/ssl.c

changeset 3
bd2b1836f0ba
parent 2
0cfca30f1ce3
child 4
718837c61318
equal deleted inserted replaced
2:0cfca30f1ce3 3:bd2b1836f0ba
354 p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection"); 354 p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
355 lua_pushlightuserdata(L, (void*)ssl->ssl); 355 lua_pushlightuserdata(L, (void*)ssl->ssl);
356 return 1; 356 return 1;
357 } 357 }
358 358
359 /**
360 * Return the compression method used.
361 */
362 static int meth_compression(lua_State *L)
363 {
364 const COMP_METHOD *comp;
365 p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
366 comp = SSL_get_current_compression(ssl->ssl);
367 if (comp) {
368 lua_pushstring(L, SSL_COMP_get_name(comp));
369 return 1;
370 } else {
371 lua_pushboolean(L, 0);
372 return 1;
373 }
374 }
359 /*---------------------------------------------------------------------------*/ 375 /*---------------------------------------------------------------------------*/
360 376
361 377
362 /** 378 /**
363 * SSL metamethods 379 * SSL metamethods
364 */ 380 */
365 static luaL_Reg meta[] = { 381 static luaL_Reg meta[] = {
366 {"close", meth_close}, 382 {"close", meth_close},
367 {"getfd", meth_getfd}, 383 {"getfd", meth_getfd},
368 {"dirty", meth_dirty}, 384 {"dirty", meth_dirty},
369 {"dohandshake", meth_handshake}, 385 {"dohandshake", meth_handshake},
370 {"receive", meth_receive}, 386 {"receive", meth_receive},
371 {"send", meth_send}, 387 {"send", meth_send},
372 {"settimeout", meth_settimeout}, 388 {"settimeout", meth_settimeout},
373 {"want", meth_want}, 389 {"want", meth_want},
374 {NULL, NULL} 390 {"compression", meth_compression},
391 {NULL, NULL}
375 }; 392 };
376 393
377 /** 394 /**
378 * SSL functions 395 * SSL functions
379 */ 396 */

mercurial