From ed12670393570bdf8c561feda48497b6c75b99a3 Mon Sep 17 00:00:00 2001 From: nishi Date: Wed, 21 Feb 2024 14:03:04 +0000 Subject: [PATCH] adding irc support git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@245 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/httpd/httpd.c | 484 +++++++++++++++++++++--------------------- Library/Core.c | 23 +- Library/IRC.c | 4 +- Library/URL.c | 4 + W3Version.h.m4 | 2 +- 5 files changed, 267 insertions(+), 250 deletions(-) diff --git a/Example/httpd/httpd.c b/Example/httpd/httpd.c index efba814..a605980 100644 --- a/Example/httpd/httpd.c +++ b/Example/httpd/httpd.c @@ -8,13 +8,13 @@ #include #include +#include +#include #include -#include #include -#include +#include #include #include -#include #include @@ -33,17 +33,17 @@ char* notfound_header; char** types = NULL; int ntypes = 0; -void add_type(char* key, char* value){ - if(types == NULL){ +void add_type(char* key, char* value) { + if(types == NULL) { types = malloc(sizeof(*types) * 2); types[0] = __W3_Strdup(key); types[1] = __W3_Strdup(value); ntypes = 2; - }else{ + } else { char** oldtypes = types; int i; types = malloc(sizeof(*types) * (ntypes + 2)); - for(i = 0; i < ntypes; i++){ + for(i = 0; i < ntypes; i++) { types[i] = oldtypes[i]; } types[ntypes] = __W3_Strdup(key); @@ -53,7 +53,7 @@ void add_type(char* key, char* value){ } } -void http_handler(int sock){ +void http_handler(int sock) { __W3_Debug("HTTPd", "Got a connection"); char* buf = malloc(BUFFER_SIZE); int phase = 0; @@ -73,271 +73,270 @@ void http_handler(int sock){ cbuf[1] = 0; char* line = malloc(1); line[0] = 0; - while(true){ + while(true) { int len = recv(sock, buf, BUFFER_SIZE, 0); if(len <= 0) break; int i; - for(i = 0; i < len; i++){ - if(phase == 0){ - if(buf[i] == ' '){ + for(i = 0; i < len; i++) { + if(phase == 0) { + if(buf[i] == ' ') { phase++; - }else{ + } else { cbuf[0] = buf[i]; char* tmp = method; method = __W3_Concat(tmp, cbuf); free(tmp); } - }else if(phase == 1){ - if(buf[i] == ' '){ + } else if(phase == 1) { + if(buf[i] == ' ') { phase++; - }else{ + } else { cbuf[0] = buf[i]; char* tmp = path; path = __W3_Concat(tmp, cbuf); free(tmp); } - }else if(phase == 2){ - if(buf[i] == '\n'){ + } else if(phase == 2) { + if(buf[i] == '\n') { phase++; - if(strlen(version) < 8){ + if(strlen(version) < 8) { send(sock, badreq_header, strlen(badreq_header), 0); send(sock, badreq, strlen(badreq), 0); goto quit; - }else{ - if(strcmp(version + 5, "1.1") == 0 || strcmp(version + 5, "1.0") == 0){ - }else{ + } else { + if(strcmp(version + 5, "1.1") == 0 || strcmp(version + 5, "1.0") == 0) { + } else { send(sock, badreq_header, strlen(badreq_header), 0); send(sock, badreq, strlen(badreq), 0); goto quit; } } - }else if(buf[i] != '\r'){ + } else if(buf[i] != '\r') { cbuf[0] = buf[i]; char* tmp = version; version = __W3_Concat(tmp, cbuf); free(tmp); } - }else if(phase == 3){ - if(buf[i] == '\n'){ + } else if(phase == 3) { + if(buf[i] == '\n') { if(strcmp(line, "") == 0) phase++; free(line); line = malloc(1); line[0] = 0; - if(phase == 4){ + if(phase == 4) { if(strcasecmp(method, "GET") == 0 || strcasecmp(method, "HEAD") == 0) goto response; } - }else if(buf[i] != '\r'){ + } else if(buf[i] != '\r') { cbuf[0] = buf[i]; char* tmp = line; line = __W3_Concat(tmp, cbuf); free(tmp); } - }else if(phase == 4){ + } else if(phase == 4) { } } } goto quit; -response: - { - /* Using goto is not a good idea! but hey, it works. */ - char* realpath = __W3_Concat3(root, "/", path); +response : { + /* Using goto is not a good idea! but hey, it works. */ + char* realpath = __W3_Concat3(root, "/", path); + + struct stat s; + if(stat(realpath, &s) == 0) { + if(S_ISDIR(s.st_mode)) { + if(path[strlen(path) - 1] == '/') { + char* html = malloc(1); + html[0] = 0; + char* tmp; + + tmp = html; + html = __W3_Concat3(tmp, "Index of ", path); + free(tmp); - struct stat s; - if(stat(realpath, &s) == 0){ - if(S_ISDIR(s.st_mode)){ - if(path[strlen(path) - 1] == '/'){ - char* html = malloc(1); - html[0] = 0; - char* tmp; - - tmp = html; - html = __W3_Concat3(tmp, "<html><head><meta charset=\"UTF-8\"><title>Index of ", path); - free(tmp); + tmp = html; + html = __W3_Concat3(tmp, "

Index of ", path); + free(tmp); - tmp = html; - html = __W3_Concat3(tmp, "

Index of ", path); - free(tmp); + tmp = html; + html = __W3_Concat(tmp, "


"); + free(tmp); - tmp = html; - html = __W3_Concat(tmp, "
NameSize
"); - free(tmp); + struct dirent** namelist; + int n = scandir(realpath, &namelist, NULL, alphasort); - struct dirent** namelist; - int n = scandir(realpath, &namelist, NULL, alphasort); - - if(n >= 0){ - int i; - bool dir = true; -rep:; - for(i = 0; i < n; i++){ - char* fpath = __W3_Concat3(realpath, "/", namelist[i]->d_name); - struct stat s2; - if(stat(fpath, &s2) == 0){ - if((dir ? S_ISDIR(s2.st_mode) : !S_ISDIR(s2.st_mode)) && strcmp(namelist[i]->d_name, ".") != 0){ - tmp = html; - html = __W3_Concat3(tmp, ""); - free(tmp); - - char* bytes = malloc(2049); - char* suffix = __W3_Strdup(" B"); - - double bsize = s2.st_size; - - if(S_ISDIR(s2.st_mode)){ - sprintf(bytes, "<Directory>"); + if(n >= 0) { + int i; + bool dir = true; + rep:; + for(i = 0; i < n; i++) { + char* fpath = __W3_Concat3(realpath, "/", namelist[i]->d_name); + struct stat s2; + if(stat(fpath, &s2) == 0) { + if((dir ? S_ISDIR(s2.st_mode) : !S_ISDIR(s2.st_mode)) && strcmp(namelist[i]->d_name, ".") != 0) { + tmp = html; + html = __W3_Concat3(tmp, ""); + free(tmp); + + char* bytes = malloc(2049); + char* suffix = __W3_Strdup(" B"); + + double bsize = s2.st_size; + + if(S_ISDIR(s2.st_mode)) { + sprintf(bytes, "<Directory>"); + free(suffix); + suffix = __W3_Strdup(""); + } else { + if(s2.st_size > 1024 * 1024 * 1024) { + free(suffix); + suffix = __W3_Strdup(" GB"); + bsize /= 1024 * 1024 * 1024; + } else if(s2.st_size > 1024 * 1024) { free(suffix); - suffix = __W3_Strdup(""); - }else{ - if(s2.st_size > 1024 * 1024 * 1024){ - free(suffix); - suffix = __W3_Strdup(" GB"); - bsize /= 1024 * 1024 * 1024; - }else if(s2.st_size > 1024 * 1024){ - free(suffix); - suffix = __W3_Strdup(" MB"); - bsize /= 1024 * 1024; - }else if(s2.st_size > 1024){ - free(suffix); - suffix = __W3_Strdup(" KB"); - bsize /= 1024; - } - sprintf(bytes, "%.2f", bsize); + suffix = __W3_Strdup(" MB"); + bsize /= 1024 * 1024; + } else if(s2.st_size > 1024) { + free(suffix); + suffix = __W3_Strdup(" KB"); + bsize /= 1024; } + sprintf(bytes, "%.2f", bsize); + } - tmp = html; - html = __W3_Concat3(tmp, ""); - free(tmp); + tmp = html; + html = __W3_Concat3(tmp, suffix, ""); + free(tmp); - free(bytes); - free(suffix); - } + free(bytes); + free(suffix); } - if(!dir) free(namelist[i]); - } - if(!dir) free(namelist); - if(dir){ - dir = false; - goto rep; } + if(!dir) free(namelist[i]); + } + if(!dir) free(namelist); + if(dir) { + dir = false; + goto rep; } + } - tmp = html; - html = __W3_Concat(tmp, "
NameSize
d_name); - free(tmp); - - tmp = html; - html = __W3_Concat(tmp, "\">"); - free(tmp); - - tmp = html; - html = __W3_Concat(tmp, namelist[i]->d_name); - free(tmp); - - tmp = html; - html = __W3_Concat3(tmp, dir ? "/" : "", "
d_name); + free(tmp); + + tmp = html; + html = __W3_Concat(tmp, "\">"); + free(tmp); + + tmp = html; + html = __W3_Concat(tmp, namelist[i]->d_name); + free(tmp); + + tmp = html; + html = __W3_Concat3(tmp, dir ? "/" : "", "", bytes); - free(tmp); + tmp = html; + html = __W3_Concat3(tmp, "", bytes); + free(tmp); - tmp = html; - html = __W3_Concat3(tmp, suffix, "

LibW3-HTTPd (LibW3/" LIBW3_VERSION ")"); - free(tmp); + tmp = html; + html = __W3_Concat(tmp, "
LibW3-HTTPd (LibW3/" LIBW3_VERSION ")"); + free(tmp); - send(sock, "HTTP/1.1 200 OK\r\n", 17, 0); - send(sock, "Connection: close\r\n", 19, 0); - send(sock, "Server: ", 8, 0); - send(sock, "LibW3-HTTPd (LibW3/", 19, 0); - send(sock, LIBW3_VERSION, strlen(LIBW3_VERSION), 0); - send(sock, ")", 1, 0); - send(sock, "\r\n", 2, 0); - send(sock, "Content-Type: text/html\r\n", 25, 0); - char* length = malloc(1025); - sprintf(length, "%d", strlen(html)); - send(sock, "Content-Length: ", 16, 0); - send(sock, length, strlen(length), 0); - send(sock, "\r\n", 2, 0); - send(sock, "\r\n", 2, 0); - if(strcasecmp(method, "HEAD") != 0) send(sock, html, strlen(html), 0); - free(html); - }else{ - send(sock, "HTTP/1.1 308 Permanent Redirect\r\n", 33, 0); - send(sock, "Connection: close\r\n", 19, 0); - send(sock, "Server: ", 8, 0); - send(sock, "LibW3-HTTPd (LibW3/", 19, 0); - send(sock, LIBW3_VERSION, strlen(LIBW3_VERSION), 0); - send(sock, ")", 1, 0); - send(sock, "\r\n", 2, 0); - send(sock, "Location: ", 10, 0); - send(sock, path, strlen(path), 0); - send(sock, "/", 1, 0); - send(sock, "\r\n", 2, 0); - send(sock, "\r\n", 2, 0); - } - }else{ send(sock, "HTTP/1.1 200 OK\r\n", 17, 0); send(sock, "Connection: close\r\n", 19, 0); - char* length = malloc(1025); - sprintf(length, "%d", s.st_size); - send(sock, "Content-Type: ", 14, 0); - if(types == NULL){ - send(sock, "application/octet-stream", 24, 0); - }else{ - int i; - char* fpath = __W3_Strdup(path); - bool found = false; - for(i = strlen(fpath) - 1; i >= 0; i--){ - if(fpath[i] == '.'){ - fpath[i] = 0; - found = true; - break; - } - } - if(found){ - found = false; - int start = i + 1; - for(i = 0; i < ntypes; i += 2){ - if(strcasecmp(types[i], fpath + start) == 0){ - found = true; - send(sock, types[i + 1], strlen(types[i + 1]), 0); - break; - } - } - if(!found){ - send(sock, "application/octet-stream", 24, 0); - } - }else{ - send(sock, "application/octet-stream", 24, 0); - } - free(fpath); - } + send(sock, "Server: ", 8, 0); + send(sock, "LibW3-HTTPd (LibW3/", 19, 0); + send(sock, LIBW3_VERSION, strlen(LIBW3_VERSION), 0); + send(sock, ")", 1, 0); send(sock, "\r\n", 2, 0); + send(sock, "Content-Type: text/html\r\n", 25, 0); + char* length = malloc(1025); + sprintf(length, "%d", strlen(html)); send(sock, "Content-Length: ", 16, 0); send(sock, length, strlen(length), 0); - free(length); send(sock, "\r\n", 2, 0); + send(sock, "\r\n", 2, 0); + if(strcasecmp(method, "HEAD") != 0) send(sock, html, strlen(html), 0); + free(html); + } else { + send(sock, "HTTP/1.1 308 Permanent Redirect\r\n", 33, 0); + send(sock, "Connection: close\r\n", 19, 0); send(sock, "Server: ", 8, 0); send(sock, "LibW3-HTTPd (LibW3/", 19, 0); send(sock, LIBW3_VERSION, strlen(LIBW3_VERSION), 0); send(sock, ")", 1, 0); send(sock, "\r\n", 2, 0); + send(sock, "Location: ", 10, 0); + send(sock, path, strlen(path), 0); + send(sock, "/", 1, 0); + send(sock, "\r\n", 2, 0); send(sock, "\r\n", 2, 0); - if(strcasecmp(method, "HEAD") != 0){ - FILE* f = fopen(realpath, "r"); - char* buf = malloc(BUFFER_SIZE); - while(true){ - int len = fread(buf, 1, BUFFER_SIZE, f); - if(len <= 0) break; - send(sock, buf, len, 0); + } + } else { + send(sock, "HTTP/1.1 200 OK\r\n", 17, 0); + send(sock, "Connection: close\r\n", 19, 0); + char* length = malloc(1025); + sprintf(length, "%d", s.st_size); + send(sock, "Content-Type: ", 14, 0); + if(types == NULL) { + send(sock, "application/octet-stream", 24, 0); + } else { + int i; + char* fpath = __W3_Strdup(path); + bool found = false; + for(i = strlen(fpath) - 1; i >= 0; i--) { + if(fpath[i] == '.') { + fpath[i] = 0; + found = true; + break; } - fclose(f); - free(buf); } + if(found) { + found = false; + int start = i + 1; + for(i = 0; i < ntypes; i += 2) { + if(strcasecmp(types[i], fpath + start) == 0) { + found = true; + send(sock, types[i + 1], strlen(types[i + 1]), 0); + break; + } + } + if(!found) { + send(sock, "application/octet-stream", 24, 0); + } + } else { + send(sock, "application/octet-stream", 24, 0); + } + free(fpath); + } + send(sock, "\r\n", 2, 0); + send(sock, "Content-Length: ", 16, 0); + send(sock, length, strlen(length), 0); + free(length); + send(sock, "\r\n", 2, 0); + send(sock, "Server: ", 8, 0); + send(sock, "LibW3-HTTPd (LibW3/", 19, 0); + send(sock, LIBW3_VERSION, strlen(LIBW3_VERSION), 0); + send(sock, ")", 1, 0); + send(sock, "\r\n", 2, 0); + send(sock, "\r\n", 2, 0); + if(strcasecmp(method, "HEAD") != 0) { + FILE* f = fopen(realpath, "r"); + char* buf = malloc(BUFFER_SIZE); + while(true) { + int len = fread(buf, 1, BUFFER_SIZE, f); + if(len <= 0) break; + send(sock, buf, len, 0); + } + fclose(f); + free(buf); } - }else{ - send(sock, notfound_header, strlen(notfound_header), 0); - send(sock, notfound, strlen(notfound), 0); } - - free(realpath); + } else { + send(sock, notfound_header, strlen(notfound_header), 0); + send(sock, notfound, strlen(notfound), 0); } + + free(realpath); +} quit:; free(line); free(method); @@ -350,53 +349,48 @@ int main(int argc, char** argv) { int i; char* portstr = NULL; char* configfile = "/etc/httpd.conf"; - for(i = 1; argv[i] != NULL; i++){ + for(i = 1; argv[i] != NULL; i++) { if(strcmp(argv[i], "--version") == 0) { printf("LibW3 %s\n", LIBW3_VERSION); return 0; - }else if(strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-c") == 0) { + } else if(strcmp(argv[i], "--config") == 0 || strcmp(argv[i], "-c") == 0) { configfile = argv[i + 1]; - }else if(strcmp(argv[i], "--port") == 0 || strcmp(argv[i], "-p") == 0) { + } else if(strcmp(argv[i], "--port") == 0 || strcmp(argv[i], "-p") == 0) { portstr = argv[i + 1]; - }else if(argv[i][0] == '-'){ + } else if(argv[i][0] == '-') { fprintf(stderr, "%s: invalid option: %s\n", argv[0], argv[i]); return 1; } } - badreq = __W3_Strdup( -"" \ -" " \ -" " \ -" " \ -" " \ -"

Bad request

" \ -"
" \ -" LibW3-HTTPd (LibW3/" LIBW3_VERSION ")" \ -" " \ -"" -); + badreq = __W3_Strdup("" + " " + " " + " " + " " + "

Bad request

" + "
" + " LibW3-HTTPd (LibW3/" LIBW3_VERSION ")" + " " + ""); badreq_header = malloc(2048); sprintf(badreq_header, "HTTP/1.1 400 Bad Request\r\nContent-Type: text/html\r\nContent-Length: %d\r\nServer: LibW3-HTTPd (LibW3/" LIBW3_VERSION ")\r\nConnection: close\r\n\r\n", strlen(badreq)); - - notfound = __W3_Strdup( -"" \ -" " \ -" " \ -" " \ -" " \ -"

Not Found

" \ -"
" \ -" LibW3-HTTPd (LibW3/" LIBW3_VERSION ")" \ -" " \ -"" -); + notfound = __W3_Strdup("" + " " + " " + " " + " " + "

Not Found

" + "
" + " LibW3-HTTPd (LibW3/" LIBW3_VERSION ")" + " " + ""); notfound_header = malloc(2048); sprintf(notfound_header, "HTTP/1.1 404 Not Found\r\nContent-Type: text/html\r\nContent-Length: %d\r\nServer: LibW3-HTTPd (LibW3/" LIBW3_VERSION ")\r\nConnection: close\r\n\r\n", strlen(notfound)); FILE* f = fopen(configfile, "r"); - if(f != NULL){ + if(f != NULL) { struct stat s; stat(configfile, &s); char* buf = malloc(s.st_size + 1); @@ -410,41 +404,41 @@ int main(int argc, char** argv) { cbuf[1] = 0; int linenum = 0; int err = 0; - for(i = 0;; i++){ - if(buf[i] == '\n' || buf[i] == 0){ + for(i = 0;; i++) { + if(buf[i] == '\n' || buf[i] == 0) { linenum++; - if(line[0] != '#' && strcmp(line, "") != 0){ + if(line[0] != '#' && strcmp(line, "") != 0) { int j; bool hasparam = false; - for(j = 0; line[j] != 0; j++){ - if(line[j] == ' '){ + for(j = 0; line[j] != 0; j++) { + if(line[j] == ' ') { line[j] = 0; hasparam = true; break; } } - if(strcasecmp(line, "Root") == 0){ - if(!hasparam){ + if(strcasecmp(line, "Root") == 0) { + if(!hasparam) { fprintf(stderr, "%s: config line %d, directive needs a parameter\n", argv[0], linenum); err++; } if(root != NULL) free(root); root = __W3_Strdup(line + j + 1); - }else if(strcasecmp(line, "MIME") == 0){ - if(!hasparam){ + } else if(strcasecmp(line, "MIME") == 0) { + if(!hasparam) { fprintf(stderr, "%s: config line %d, directive needs a parameter\n", argv[0], linenum); err++; } int k; char* param = line + j + 1; - for(k = 0; param[k] != 0; k++){ - if(param[k] == ' '){ + for(k = 0; param[k] != 0; k++) { + if(param[k] == ' ') { param[k] = 0; add_type(param, param + k + 1); break; } } - }else{ + } else { fprintf(stderr, "%s: config line %d, unknown directive\n", argv[0], linenum); err++; } @@ -453,7 +447,7 @@ int main(int argc, char** argv) { line = malloc(1); line[0] = 0; if(buf[i] == 0) break; - }else if(buf[i] != '\r'){ + } else if(buf[i] != '\r') { /* Rejecting \r is a good idea for the time when I add the Windows support. */ cbuf[0] = buf[i]; char* tmp = line; @@ -466,17 +460,17 @@ int main(int argc, char** argv) { free(buf); fclose(f); - if(root == NULL){ + if(root == NULL) { fprintf(stderr, "%s: config has no root directive\n", argv[0]); err++; } - if(err > 0){ + if(err > 0) { fprintf(stderr, "%s: config has %d errors\n", argv[0], err); free(badreq_header); free(badreq); return 1; } - }else{ + } else { free(badreq_header); free(badreq); fprintf(stderr, "%s: failed to load the config file\n", argv[0]); @@ -486,7 +480,7 @@ int main(int argc, char** argv) { W3_Library_Init(); __W3_Debug("HTTPd", "Ready"); int st = ls_start_server(portstr == NULL ? 80 : atoi(portstr), http_handler); - if(st == -1){ + if(st == -1) { fprintf(stderr, "%s: failed to start the server\n", argv[0]); return 1; } diff --git a/Library/Core.c b/Library/Core.c index 2d75e07..f120cf3 100644 --- a/Library/Core.c +++ b/Library/Core.c @@ -41,6 +41,10 @@ #include "W3Gemini.h" #endif +#ifdef IRC_SUPPORT +#include "W3IRC.h" +#endif + #include #include #include @@ -107,7 +111,10 @@ 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) { + if(0) { +#ifdef HTTP_SUPPORT + } else if(strcmp(protocol, "http") == 0) { +#endif #ifdef SSL_SUPPORT #ifdef HTTP_SUPPORT } else if(strcmp(protocol, "https") == 0) { @@ -121,6 +128,9 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) { #ifdef GOPHER_SUPPORT } else if(strcmp(protocol, "gophers") == 0) { #endif +#ifdef IRC_SUPPORT + } else if(strcmp(protocol, "ircs") == 0) { +#endif #endif #ifdef NEX_SUPPORT } else if(strcmp(protocol, "nex") == 0) { @@ -139,6 +149,9 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) { #endif #ifdef NNTP_SUPPORT } else if(strcmp(protocol, "nntp") == 0 || strcmp(protocol, "news") == 0) { +#endif +#ifdef IRC_SUPPORT + } else if(strcmp(protocol, "irc") == 0) { #endif } else { __W3_Debug("Protocol", "Not suppported"); @@ -241,6 +254,14 @@ void W3_Send_Request(struct W3* w3) { #ifdef FILE_SUPPORT } else if(strcmp(w3->protocol, "file") == 0) { __W3_File_Request(w3); +#endif +#ifdef IRC_SUPPORT + } else if(strcmp(w3->protocol, "irc") == 0 +#ifdef SSL_SUPPORT + || strcmp(w3->protocol, "ircs") == 0 +#endif + ) { + __W3_IRC_Request(w3); #endif } } diff --git a/Library/IRC.c b/Library/IRC.c index 1f2f484..ff9b4eb 100644 --- a/Library/IRC.c +++ b/Library/IRC.c @@ -12,6 +12,4 @@ extern int strcasecmp(const char* s1, const char* s2); #endif -void __W3_IRC_Request(struct W3* w3) { - __W3_Debug("LibW3-IRC", "Sending the request"); -} +void __W3_IRC_Request(struct W3* w3) { __W3_Debug("LibW3-IRC", "Sending the request"); } diff --git a/Library/URL.c b/Library/URL.c index dcb9298..c57d2db 100644 --- a/Library/URL.c +++ b/Library/URL.c @@ -130,6 +130,10 @@ struct W3URL* W3_Parse_URL(const char* _url) { r->port = 21; } else if(strcmp(r->protocol, "nntp") == 0 || strcmp(r->protocol, "news") == 0) { r->port = 119; + } else if(strcmp(r->protocol, "irc") == 0) { + r->port = 6667; + } else if(strcmp(r->protocol, "ircs") == 0) { + r->port = 6697; } } r->host = __W3_Strdup(url + start + (atmark == 0 ? 0 : (atmark - 1))); diff --git a/W3Version.h.m4 b/W3Version.h.m4 index dd055b9..3e483cc 100644 --- a/W3Version.h.m4 +++ b/W3Version.h.m4 @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.16I" \ +#define LIBW3_VERSION "2.17" \ SUFFIX ifdef(`HTTP_SUPPORT', `#define LIBW3_HTTP_SUPPORT', `') -- 2.43.0