From c440b3c1104decbb5d887bdf184dfcb6f1d7c3e8 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 17 Feb 2024 08:24:03 +0000 Subject: [PATCH] welp git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@242 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/httpd/httpd.c | 19 +++++++++++++++++-- W3Version.h.m4 | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Example/httpd/httpd.c b/Example/httpd/httpd.c index 1006c37..b7eef42 100644 --- a/Example/httpd/httpd.c +++ b/Example/httpd/httpd.c @@ -242,6 +242,11 @@ rep:; 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)); @@ -254,6 +259,11 @@ rep:; }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); @@ -302,6 +312,11 @@ rep:; 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); FILE* f = fopen(realpath, "r"); char* buf = malloc(BUFFER_SIZE); @@ -359,7 +374,7 @@ int main(int argc, char** argv) { "" ); badreq_header = malloc(2048); - sprintf(badreq_header, "HTTP/1.1 400 Bad Request\r\nContent-Type: text/html\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", strlen(badreq)); + 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( @@ -375,7 +390,7 @@ int main(int argc, char** argv) { "" ); notfound_header = malloc(2048); - sprintf(notfound_header, "HTTP/1.1 404 Not Found\r\nContent-Type: text/html\r\nContent-Length: %d\r\nConnection: close\r\n\r\n", strlen(notfound)); + 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){ diff --git a/W3Version.h.m4 b/W3Version.h.m4 index 1b9ba85..cb37889 100644 --- a/W3Version.h.m4 +++ b/W3Version.h.m4 @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.16G" \ +#define LIBW3_VERSION "2.16H" \ SUFFIX ifdef(`HTTP_SUPPORT', `#define LIBW3_HTTP_SUPPORT', `') -- 2.43.0