diff options
author | Christian Grothoff <christian@grothoff.org> | 2007-08-08 20:48:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2007-08-08 20:48:41 +0000 |
commit | 2d797e7b5e22d6502226e6cd9cf8eb2fc0a2454f (patch) | |
tree | 063338cdffdcc485e077d38a6441320d2dc6e5f7 | |
parent | 268f93a9686c899d954c1892ec62aefcaa6fc4a3 (diff) | |
download | libmicrohttpd-2d797e7b5e22d6502226e6cd9cf8eb2fc0a2454f.tar.gz libmicrohttpd-2d797e7b5e22d6502226e6cd9cf8eb2fc0a2454f.zip |
fixing 1261
-rw-r--r-- | AUTHORS | 5 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | doc/libmicrohttpd.3 | 34 | ||||
-rw-r--r-- | src/daemon/connection.c | 39 | ||||
-rw-r--r-- | src/daemon/connection.h | 2 | ||||
-rw-r--r-- | src/daemon/daemon.c | 2 | ||||
-rw-r--r-- | src/daemon/internal.c | 2 | ||||
-rw-r--r-- | src/daemon/internal.h | 2 | ||||
-rw-r--r-- | src/daemon/memorypool.c | 2 | ||||
-rw-r--r-- | src/daemon/memorypool.h | 2 | ||||
-rw-r--r-- | src/daemon/response.c | 2 | ||||
-rw-r--r-- | src/daemon/response.h | 2 |
12 files changed, 69 insertions, 26 deletions
@@ -1,2 +1,7 @@ | |||
1 | Primary developer: | ||
1 | Christian Grothoff <christian@grothoff.org> | 2 | Christian Grothoff <christian@grothoff.org> |
3 | |||
4 | Code contributions also came from: | ||
2 | Chris GauthierDickey <chrisg@cs.du.edu> | 5 | Chris GauthierDickey <chrisg@cs.du.edu> |
6 | Daniel Pittman | ||
7 | Nils Durner <durner@gnunet.org> | ||
@@ -16,7 +16,6 @@ For http/1.1-compliance: | |||
16 | connection.c: | 16 | connection.c: |
17 | - support chunked requests from clients (#1260, ARCH, TEST) | 17 | - support chunked requests from clients (#1260, ARCH, TEST) |
18 | - send proper error code back if client forgot the "Host" header (#1264, TRIV) | 18 | - send proper error code back if client forgot the "Host" header (#1264, TRIV) |
19 | - automatically add MHD_HTTP_HEADER_DATE if client "forgot" to add one (#1261, TRIV) | ||
20 | 19 | ||
21 | For POST: | 20 | For POST: |
22 | ========= | 21 | ========= |
diff --git a/doc/libmicrohttpd.3 b/doc/libmicrohttpd.3 index 72c6a968..4480c93c 100644 --- a/doc/libmicrohttpd.3 +++ b/doc/libmicrohttpd.3 | |||
@@ -1,28 +1,36 @@ | |||
1 | .TH LIBMICROHTTPD 3 "Jan 12, 2007" | 1 | .TH LIBMICROHTTPD "3" "08 Aug 2007" "libmicrohttpd" |
2 | .SH NAME | 2 | .SH "NAME" |
3 | libmicrohttpd \- description 0.0.0 | 3 | libmicrohttpd \- library for embedding HTTP servers |
4 | .SH SYNOPSIS | 4 | .SH "SYNOPSIS" |
5 | 5 | ||
6 | \fB#include <microhttpd.h> | 6 | \fB#include <microhttpd.h> |
7 | 7 | ||
8 | Insert API here. | 8 | \fPInsert API here. |
9 | 9 | ||
10 | .SH DESCRIPTION | 10 | .SH "DESCRIPTION" |
11 | .P | 11 | .P |
12 | Insert API description here. | 12 | Insert API description here. |
13 | 13 | ||
14 | .P | 14 | .P |
15 | .SH "SEE ALSO" | 15 | .SH "SEE ALSO" |
16 | fixme(1) | 16 | \fBcurl\fP(1), \fBlibcurl\fP(3) |
17 | 17 | ||
18 | .SH LEGAL NOTICE | 18 | .SH "LEGAL NOTICE" |
19 | libmicrohttpd is released under the GPL. | 19 | libmicrohttpd is released under the GPL. |
20 | 20 | ||
21 | .SH BUGS | 21 | .SH "FILES" |
22 | None, of course. | 22 | .TP |
23 | microhttpd.h | ||
24 | libmicrohttpd include file | ||
25 | .TP | ||
26 | libmicrohttpd.so | ||
27 | libmicrohttpd library | ||
23 | 28 | ||
24 | .SH AUTHORS | 29 | .SH "REPORTING BUGS" |
25 | libmicrohttpd was originally designed by Christian Grothoff <christian@grothoff.org> and Chris GauthierDickey <chrisg@cs.du.edu>. | 30 | Report bugs by using mantis <https://gnunet.org/mantis/>. |
26 | 31 | ||
27 | .SH AVAILABILITY | 32 | .SH "AUTHORS" |
33 | libmicrohttpd was originally designed by Christian Grothoff <christian@grothoff.org> and Chris GauthierDickey <chrisg@cs.du.edu>. The implementation was done by Daniel Pittman and Christian Grothoff. | ||
34 | |||
35 | .SH "AVAILABILITY" | ||
28 | You can obtain the latest version from http://gnunet.org/libmicrohttpd/. | 36 | You can obtain the latest version from http://gnunet.org/libmicrohttpd/. |
diff --git a/src/daemon/connection.c b/src/daemon/connection.c index 5139ae0c..505e4aad 100644 --- a/src/daemon/connection.c +++ b/src/daemon/connection.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -880,10 +880,10 @@ MHD_add_extra_headers(struct MHD_Connection * connection) { | |||
880 | 880 | ||
881 | if (connection->response->total_size == -1) { | 881 | if (connection->response->total_size == -1) { |
882 | have = MHD_get_response_header(connection->response, | 882 | have = MHD_get_response_header(connection->response, |
883 | "Connection"); | 883 | MHD_HTTP_HEADER_CONNECTION); |
884 | if (have == NULL) | 884 | if (have == NULL) |
885 | MHD_add_response_header(connection->response, | 885 | MHD_add_response_header(connection->response, |
886 | "Connection", | 886 | MHD_HTTP_HEADER_CONNECTION, |
887 | "close"); | 887 | "close"); |
888 | } else if (NULL == MHD_get_response_header(connection->response, | 888 | } else if (NULL == MHD_get_response_header(connection->response, |
889 | MHD_HTTP_HEADER_CONTENT_LENGTH)) { | 889 | MHD_HTTP_HEADER_CONTENT_LENGTH)) { |
@@ -894,7 +894,28 @@ MHD_add_extra_headers(struct MHD_Connection * connection) { | |||
894 | MHD_add_response_header(connection->response, | 894 | MHD_add_response_header(connection->response, |
895 | MHD_HTTP_HEADER_CONTENT_LENGTH, | 895 | MHD_HTTP_HEADER_CONTENT_LENGTH, |
896 | buf); | 896 | buf); |
897 | } | 897 | } |
898 | } | ||
899 | |||
900 | static void get_date_string(char * date, | ||
901 | unsigned int max) { | ||
902 | static const char * days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; | ||
903 | static const char * mons[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; | ||
904 | struct tm now; | ||
905 | time_t t; | ||
906 | |||
907 | time(&t); | ||
908 | gmtime_r(&t, &now); | ||
909 | snprintf(date, | ||
910 | max-1, | ||
911 | "Date: %3s, %02u %3s %04u %02u:%02u:%02u GMT\r\n", | ||
912 | days[now.tm_wday % 7], | ||
913 | now.tm_mday, | ||
914 | mons[now.tm_mon % 12], | ||
915 | now.tm_year, | ||
916 | now.tm_hour, | ||
917 | now.tm_min, | ||
918 | now.tm_sec); | ||
898 | } | 919 | } |
899 | 920 | ||
900 | /** | 921 | /** |
@@ -908,6 +929,7 @@ MHD_build_header_response(struct MHD_Connection * connection) { | |||
908 | size_t off; | 929 | size_t off; |
909 | struct MHD_HTTP_Header * pos; | 930 | struct MHD_HTTP_Header * pos; |
910 | char code[32]; | 931 | char code[32]; |
932 | char date[128]; | ||
911 | char * data; | 933 | char * data; |
912 | 934 | ||
913 | MHD_add_extra_headers(connection); | 935 | MHD_add_extra_headers(connection); |
@@ -923,6 +945,12 @@ MHD_build_header_response(struct MHD_Connection * connection) { | |||
923 | size += strlen(pos->header) + strlen(pos->value) + 4; /* colon, space, linefeeds */ | 945 | size += strlen(pos->header) + strlen(pos->value) + 4; /* colon, space, linefeeds */ |
924 | pos = pos->next; | 946 | pos = pos->next; |
925 | } | 947 | } |
948 | if (NULL == MHD_get_response_header(connection->response, | ||
949 | MHD_HTTP_HEADER_DATE)) | ||
950 | get_date_string(date, sizeof(date)); | ||
951 | else | ||
952 | date[0] = '\0'; | ||
953 | size += strlen(date); | ||
926 | /* produce data */ | 954 | /* produce data */ |
927 | data = MHD_pool_allocate(connection->pool, | 955 | data = MHD_pool_allocate(connection->pool, |
928 | size + 1, | 956 | size + 1, |
@@ -944,6 +972,9 @@ MHD_build_header_response(struct MHD_Connection * connection) { | |||
944 | off += strlen(pos->header) + strlen(pos->value) + 4; | 972 | off += strlen(pos->header) + strlen(pos->value) + 4; |
945 | pos = pos->next; | 973 | pos = pos->next; |
946 | } | 974 | } |
975 | strcpy(&data[off], | ||
976 | date); | ||
977 | off += strlen(date); | ||
947 | sprintf(&data[off], | 978 | sprintf(&data[off], |
948 | "\r\n"); | 979 | "\r\n"); |
949 | off += 2; | 980 | off += 2; |
diff --git a/src/daemon/connection.h b/src/daemon/connection.h index 59b99004..840ae640 100644 --- a/src/daemon/connection.h +++ b/src/daemon/connection.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 48ec9219..57035fd1 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/internal.c b/src/daemon/internal.c index eed1acba..ef67affc 100644 --- a/src/daemon/internal.c +++ b/src/daemon/internal.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/internal.h b/src/daemon/internal.h index 1c3525f6..57e5ebf1 100644 --- a/src/daemon/internal.h +++ b/src/daemon/internal.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/memorypool.c b/src/daemon/memorypool.c index 5b54cd2e..d8e835e8 100644 --- a/src/daemon/memorypool.c +++ b/src/daemon/memorypool.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/memorypool.h b/src/daemon/memorypool.h index c49e0d8e..693b03f6 100644 --- a/src/daemon/memorypool.h +++ b/src/daemon/memorypool.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/response.c b/src/daemon/response.c index 4bbe0f36..b816a8a5 100644 --- a/src/daemon/response.c +++ b/src/daemon/response.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
diff --git a/src/daemon/response.h b/src/daemon/response.h index c865951f..ab582f00 100644 --- a/src/daemon/response.h +++ b/src/daemon/response.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libmicrohttpd | 2 | This file is part of libmicrohttpd |
3 | (C) 2007 Daniel Pittman | 3 | (C) 2007 Daniel Pittman and Christian Grothoff |
4 | 4 | ||
5 | libmicrohttpd is free software; you can redistribute it and/or modify | 5 | libmicrohttpd is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |