remove ssl

This commit is contained in:
Xie Han
2023-10-20 23:25:17 +08:00
parent d8d6d7f9ac
commit f5f7a61463
53 changed files with 127 additions and 2155 deletions

View File

@@ -47,11 +47,11 @@ set(TUTORIAL_LIST
)
if (APPLE)
set(WORKFLOW_LIB workflow pthread OpenSSL::SSL OpenSSL::Crypto)
set(WORKFLOW_LIB workflow pthread)
elseif (ANDROID)
set(WORKFLOW_LIB workflow ssl crypto c)
set(WORKFLOW_LIB workflow c)
else ()
set(WORKFLOW_LIB workflow pthread OpenSSL::SSL OpenSSL::Crypto ${LIBRT})
set(WORKFLOW_LIB workflow pthread ${LIBRT})
endif ()
foreach(src ${TUTORIAL_LIST})

View File

@@ -27,8 +27,8 @@
#include "workflow/WFTaskFactory.h"
#include "workflow/WFFacilities.h"
#define REDIRECT_MAX 5
#define RETRY_MAX 2
#define REDIRECT_MAX 0
#define RETRY_MAX 0
void wget_callback(WFHttpTask *task)
{
@@ -45,9 +45,6 @@ void wget_callback(WFHttpTask *task)
case WFT_STATE_DNS_ERROR:
fprintf(stderr, "DNS error: %s\n", gai_strerror(error));
break;
case WFT_STATE_SSL_ERROR:
fprintf(stderr, "SSL error: %d\n", error);
break;
case WFT_STATE_TASK_ERROR:
fprintf(stderr, "Task error: %d\n", error);
break;
@@ -117,11 +114,8 @@ int main(int argc, char *argv[])
signal(SIGINT, sig_handler);
std::string url = argv[1];
if (strncasecmp(argv[1], "http://", 7) != 0 &&
strncasecmp(argv[1], "https://", 8) != 0)
{
if (strncasecmp(argv[1], "http://", 7) != 0)
url = "http://" + url;
}
task = WFTaskFactory::create_http_task(url, REDIRECT_MAX, RETRY_MAX,
wget_callback);

View File

@@ -50,9 +50,6 @@ void redis_callback(WFRedisTask *task)
case WFT_STATE_DNS_ERROR:
fprintf(stderr, "DNS error: %s\n", gai_strerror(error));
break;
case WFT_STATE_SSL_ERROR:
fprintf(stderr, "SSL error: %d\n", error);
break;
case WFT_STATE_TASK_ERROR:
fprintf(stderr, "Task error: %d\n", error);
break;

View File

@@ -120,11 +120,8 @@ int main(int argc, char *argv[])
context.success = false;
context.http_url = argv[1];
if (strncasecmp(argv[1], "http://", 7) != 0 &&
strncasecmp(argv[1], "https://", 8) != 0)
{
if (strncasecmp(argv[1], "http://", 7) != 0)
context.http_url = "http://" + context.http_url;
}
context.redis_url = argv[2];
if (strncasecmp(argv[2], "redis://", 8) != 0 &&

View File

@@ -82,8 +82,6 @@ void http_callback(WFHttpTask *task)
err_string = strerror(error);
else if (state == WFT_STATE_DNS_ERROR)
err_string = gai_strerror(error);
else if (state == WFT_STATE_SSL_ERROR)
err_string = "SSL error";
else /* if (state == WFT_STATE_TASK_ERROR) */
err_string = "URL error (Cannot be a HTTPS proxy)";

View File

@@ -77,11 +77,8 @@ int main(int argc, char *argv[])
{
std::string url(argv[i]);
if (strncasecmp(argv[i], "http://", 7) != 0 &&
strncasecmp(argv[i], "https://", 8) != 0)
{
if (strncasecmp(argv[i], "http://", 7) != 0)
url = "http://" +url;
}
task = WFTaskFactory::create_http_task(url, REDIRECT_MAX, RETRY_MAX,
[](WFHttpTask *task)

View File

@@ -98,9 +98,9 @@ void sig_handler(int signo)
int main(int argc, char *argv[])
{
if (argc != 2 && argc != 3 && argc != 5)
if (argc != 2 && argc != 3)
{
fprintf(stderr, "%s <port> [root path] [cert file] [key file]\n",
fprintf(stderr, "%s <port> [root path]\n",
argv[0]);
exit(1);
}
@@ -111,28 +111,15 @@ int main(int argc, char *argv[])
const char *root = (argc >= 3 ? argv[2] : ".");
auto&& proc = std::bind(process, std::placeholders::_1, root);
WFHttpServer server(proc);
std::string scheme;
int ret;
if (argc == 5)
{
ret = server.start(port, argv[3], argv[4]); /* https server */
scheme = "https://";
}
else
{
ret = server.start(port);
scheme = "http://";
}
if (ret < 0)
if (server.start(port) < 0)
{
perror("start server");
exit(1);
}
/* Test the server. */
auto&& create = [&scheme, port](WFRepeaterTask *)->SubTask *{
auto&& create = [port](WFRepeaterTask *)->SubTask *{
char buf[1024];
*buf = '\0';
printf("Input file name: (Ctrl-D to exit): ");
@@ -143,7 +130,7 @@ int main(int argc, char *argv[])
return NULL;
}
std::string url = scheme + "127.0.0.1:" + std::to_string(port) + "/" + buf;
std::string url = "http://127.0.0.1:" + std::to_string(port) + "/" + buf;
WFHttpTask *task = WFTaskFactory::create_http_task(url, 0, 0,
[](WFHttpTask *task) {
auto *resp = task->get_resp();

View File

@@ -59,13 +59,13 @@ int main()
});
/* Http task1 */
http_task1 = WFTaskFactory::create_http_task("https://www.sogou.com/",
http_task1 = WFTaskFactory::create_http_task("http://www.techweb.com.cn/",
REDIRECT_MAX, RETRY_MAX,
http_callback);
http_task1->user_data = &size1;
/* Http task2 */
http_task2 = WFTaskFactory::create_http_task("https://www.baidu.com/",
http_task2 = WFTaskFactory::create_http_task("http://www.wenming.cn/",
REDIRECT_MAX, RETRY_MAX,
http_callback);
http_task2->user_data = &size2;

View File

@@ -244,11 +244,8 @@ int main(int argc, char *argv[])
signal(SIGTERM, sighandler);
std::string url = argv[1];
if (strncasecmp(argv[1], "mysql://", 8) != 0 &&
strncasecmp(argv[1], "mysqls://", 9) != 0)
{
if (strncasecmp(argv[1], "mysql://", 8) != 0)
url = "mysql://" + url;
}
const char *query = "show databases";
stop_flag = false;

View File

@@ -190,11 +190,8 @@ int main(int argc, char *argv[])
signal(SIGINT, sig_handler);
url = argv[1];
if (strncmp(argv[1], "kafka://", 8) != 0 &&
strncmp(argv[1], "kafkas://", 9) != 0)
{
if (strncmp(argv[1], "kafka://", 8) != 0)
url = "kafka://" + url;
}
char buf[512 * 1024];
WFKafkaTask *task;