[英]Getting “error LNK2001: unresolved external symbol _gnutls_free” when using GnuTLS 3.1.6 from Visual Studio 2012
[英]SNI in GNUTLS, when to ask?
因此,我正在尝试在我的GNUTLS服务器中实现SNI。
我的代码:
if(sniCallback != NULL) {
size_t ds = 256;
char data[ds];
unsigned int type = (unsigned int)GNUTLS_NAME_DNS;
int snir = gnutls_server_name_get(sessiond, &data[0], &ds, &type, (unsigned int)0);
data[ds - 1] = 0; // the last one must always be \0
if(snir >= 0) {
jstring js = (*this)->NewStringUTF(this, data);
jlong snicert = (*this)->CallLongMethod(this, sniCallback, (*this)->GetMethodID(this, (*this)->GetObjectClass(this, sniCallback), "getSNICert", "(Ljava/lang/String;)J"), js);
if(snicert > 0L) {
struct cert* oc = (struct cert*)snicert;
gnutls_credentials_set(sessiond, GNUTLS_CRD_CERTIFICATE, oc->cert);
}
} else {
printf("%i\n", snir);
}
}
(不要介意JNI)
我得到-56错误代码,即GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
,该文档将其翻译为尚未发送任何SNI。 我何时知道SNI信息? 又名,何时可以收到客户问候? 我是直接从Chrome浏览器获取的,所以我知道有SNI。 顺便说一下,这就是所有NIO。
对于那些和我一样的人,答案是:
gnutls_handshake_set_post_client_hello_function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.