Не могу запустить тест httpdatest, который поставляется с gSOAP, точнее тест запускается, но не отрабатывает корректно. По задумке, клиент обращается к серверу, который при первом подключении отвечает 401, далее в soap-контекст вносятся данные для авторизации и при повторном обращении сервер на основании приложенных данных дает добро. Под отладкой видно, что записанные в soap структуре данные, при втором вызове - NULLы, хотя должны содержать значения внесенные чз http_da_save(). В коде ничего не менял. Подскажите пожалуйста в чем дело.
Клиентская часть
int run_tests(int argc, char **argv)
{
struct soap *soap = soap_new1(SOAP_XML_INDENT);
struct ns__echoString r;
char *endpoint, *arg;
int ret;
soap_register_plugin(soap, http_da);
endpoint = argv[1];
arg = argv[2];
if (strchr(arg, 'c'))
soap_set_omode(soap, SOAP_IO_CHUNK);
if (strchr(arg, 'z'))
soap_set_omode(soap, SOAP_ENC_ZLIB);
if (soap_call_ns__echoString(soap, endpoint, NULL, arg, &r))
{
if (soap->error == 401)
{
if (!strcmp(soap->authrealm, authrealm))
{
/* save userid and passwd for basic or digest authentication */
struct http_da_info info;
http_da_save(soap, &info, authrealm, "Mufasa", "Circle Of Life");
if (!soap_call_ns__echoString(soap, endpoint, NULL, arg, &r))
{
soap_end(soap);
/* need to restore for authentication */
http_da_restore(soap, &info);
if (!soap_call_ns__echoString(soap, endpoint, NULL, arg, &r))
{
if (!strcmp(arg, r.arg))
printf("EchoString test OK\n");
else
printf("Transmission error\n");
}
}
http_da_release(soap, &info);
/* regular calls may follow */
}
}
}
if (soap->error)
soap_print_fault(soap, stderr);
ret = soap->error;
soap_destroy(soap);
soap_end(soap);
soap_free(soap);
return ret;
}
Серверная часть
int ns__echoString(struct soap *soap, char *arg, struct ns__echoString *response)
{
if (soap->userid && soap->passwd) /* Basic authentication: we may want to reject this since the password was sent in the clear */
{
if (!strcmp(soap->userid, "Mufasa") // NULL
&& !strcmp(soap->passwd, "Circle Of Life")) // NULL
{
response->arg = arg;
return SOAP_OK;
}
}
else if (soap->authrealm && soap->userid) // NULL
{
/* simulate database lookup on userid to find passwd */
if (!strcmp(soap->authrealm, authrealm) && !strcmp(soap->userid, "Mufasa"))
{
char *passwd = "Circle Of Life";
if (!http_da_verify_post(soap, passwd))
{
response->arg = arg;
return SOAP_OK;
}
}
}
soap->authrealm = authrealm;
return 401; /* Not authorized, challenge digest authentication with httpda plugin */
}
Не правильно работает проверка массива на упорядоченность по возрастанию, где ошибка?
Объясните, как работает передаче переменного количества значений в прототипе функции f? Почему тут явно указан тип S, в то время когда в других...
Есть исходный и отсортированный массивыСначала у меня выводятся оба массива, но если элементов в массиве меньше 8, то вывести их повторно,...
Учился писать код в паскалеПо ходу учебы перешел на с++ и Visual Studio