From 023f4c30136bfb2691d92e5381724cfff4853be5 Mon Sep 17 00:00:00 2001 From: nishi Date: Wed, 24 Jan 2024 13:39:50 +0000 Subject: [PATCH] added non-supported protocol error git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@59 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/fetch.c | 2 +- Library/Core.c | 10 ++++++++++ W3Version.h.p | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Example/fetch.c b/Example/fetch.c index 2d0d4c7..8b58f8c 100644 --- a/Example/fetch.c +++ b/Example/fetch.c @@ -37,7 +37,7 @@ int main(int argc, char** argv) { return 1; } W3_Library_Init(); - struct W3* w3 = W3_Create("https", argv[1], 443); + struct W3* w3 = W3_Create("http", argv[1], 80); if(w3 != NULL) { W3_Set_Read_Size(w3, 1024); W3_Set_Method(w3, argv[3] == NULL ? "GET" : argv[3]); diff --git a/Library/Core.c b/Library/Core.c index 527ac62..7bb77a8 100644 --- a/Library/Core.c +++ b/Library/Core.c @@ -63,6 +63,16 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) { w3->ssl_ctx = NULL; #endif if(strcmp(protocol, "file") != 0) { + if(strcmp(protocol, "http") == 0){ +#ifdef SSL_SUPPORT + }else if(strcmp(protocol, "https") == 0){ +#endif + }else{ + __W3_Debug("Protocol", "Not suppported"); + W3_Free(w3); + w3 = NULL; + return w3; + } w3->hostname = __W3_Strdup(hostname); if(ssl) __W3_Debug("Protocol", "Enabled SSL"); w3->sock = __W3_DNS_Connect(hostname, ssl, port diff --git a/W3Version.h.p b/W3Version.h.p index 1146e87..180169a 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "1.3" \ +#define LIBW3_VERSION "1.3A" \ SUFFIX #ifdef __cplusplus -- 2.43.0