]> Nishi Git Mirror - libw3.git/commitdiff
welp
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Sat, 17 Feb 2024 08:24:03 +0000 (08:24 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Sat, 17 Feb 2024 08:24:03 +0000 (08:24 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@242 d27a3e52-49c5-7645-884c-6793ebffc270

Example/httpd/httpd.c
W3Version.h.m4

index 1006c378df1446423dec1dd0793be1923b542e5a..b7eef4245c1be0f539b826b72533aece2505167f 100644 (file)
@@ -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) {
 "</html>"
 );
        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) {
 "</html>"
 );
        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){
index 1b9ba85459c4832a07496e59319d88a92e37828e..cb37889ec497e2d08690a0b41c72b82518ada138 100644 (file)
@@ -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', `')