Author: qboosh Date: Sun Nov 6 05:47:30 2011 GMT Module: packages Tag: HEAD ---- Log message: - updated to 0.9.16 - added info patch (unify direntries) - added missing-files patch (missing files from svn, required to rebuild info)
---- Files affected: packages/libmicrohttpd: libmicrohttpd.spec (1.16 -> 1.17) , libmicrohttpd-info.patch (NONE -> 1.1) (NEW), libmicrohttpd-missing-files.patch (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: packages/libmicrohttpd/libmicrohttpd.spec diff -u packages/libmicrohttpd/libmicrohttpd.spec:1.16 packages/libmicrohttpd/libmicrohttpd.spec:1.17 --- packages/libmicrohttpd/libmicrohttpd.spec:1.16 Wed Sep 28 11:51:56 2011 +++ packages/libmicrohttpd/libmicrohttpd.spec Sun Nov 6 06:47:25 2011 @@ -1,24 +1,27 @@ # $Revision$, $Date$ # # Conditional build -%bcond_with tests +%bcond_with tests # perform "make check" # Summary: Embeded HTTP server library Summary(pl.UTF-8): Biblioteka wbudowanego serwera HTTP Name: libmicrohttpd -Version: 0.9.15 +Version: 0.9.16 Release: 1 License: LGPL v2.1+ Group: Libraries Source0: http://ftp.gnu.org/gnu/libmicrohttpd/%{name}-%{version}.tar.gz -# Source0-md5: fb726a48095cc6b25c245dbc27ea76b0 +# Source0-md5: e1240c6ae383b5be89431932f181898a +Patch0: %{name}-info.patch +Patch1: %{name}-missing-files.patch URL: http://www.gnu.org/software/libmicrohttpd/ BuildRequires: autoconf >= 2.61 BuildRequires: automake >= 1:1.10 BuildRequires: libgcrypt-devel >= 1.2.4 BuildRequires: libtool +BuildRequires: texinfo %if %{with tests} -BuildRequires: curl-devel +BuildRequires: curl-devel >= 7.16.4 %endif BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -28,7 +31,7 @@ %description -l pl.UTF-8 GNU libmicrohttpd jest małą biblioteką C, w założeniu umożliwiającą -uruchomienie serwera HTTP jako część innej aplikacji. +uruchomienie serwera HTTP jako części innej aplikacji. %package devel Summary: Header files to develop libmicrohttpd applications @@ -56,6 +59,8 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build %{__libtoolize} @@ -106,6 +111,7 @@ %{_libdir}/libmicrohttpd.la %{_includedir}/microhttpd.h %{_infodir}/microhttpd.info* +%{_infodir}/microhttpd-tutorial.info* %{_mandir}/man3/libmicrohttpd.3* %{_pkgconfigdir}/libmicrohttpd.pc @@ -119,6 +125,11 @@ All persons listed below can be reached at <cvs_login>@pld-linux.org $Log$ +Revision 1.17 2011/11/06 05:47:25 qboosh +- updated to 0.9.16 +- added info patch (unify direntries) +- added missing-files patch (missing files from svn, required to rebuild info) + Revision 1.16 2011/09/28 09:51:56 lisu - 0.9.15 @@ -170,4 +181,3 @@ Revision 1.1 2009/10/03 12:14:33 wiget - initial - ================================================================ Index: packages/libmicrohttpd/libmicrohttpd-info.patch diff -u /dev/null packages/libmicrohttpd/libmicrohttpd-info.patch:1.1 --- /dev/null Sun Nov 6 06:47:30 2011 +++ packages/libmicrohttpd/libmicrohttpd-info.patch Sun Nov 6 06:47:25 2011 @@ -0,0 +1,28 @@ +--- libmicrohttpd-0.9.16/doc/microhttpd.texi.orig 2011-09-28 08:37:02.000000000 +0200 ++++ libmicrohttpd-0.9.16/doc/microhttpd.texi 2011-11-06 06:31:12.786669338 +0100 +@@ -22,9 +22,9 @@ + GNU libmicrohttpd is a GNU package. + @end copying + +-@dircategory GNU Libraries ++@dircategory Libraries: + @direntry +-* libmicrohttpd: (microhttpd). Embedded HTTP server library. ++* libmicrohttpd: (microhttpd). Embedded HTTP server library + @end direntry + + @c +--- libmicrohttpd-0.9.16/doc/microhttpd-tutorial.texi.orig 2011-11-04 10:02:56.000000000 +0100 ++++ libmicrohttpd-0.9.16/doc/microhttpd-tutorial.texi 2011-11-06 06:31:34.976670082 +0100 +@@ -7,9 +7,9 @@ + @set VERSION 0.9.16 + @settitle A tutorial for GNU libmicrohttpd + +-@dircategory GNU Libraries ++@dircategory Libraries: + @direntry +-* libmicrohttpdtutorial: (microhttpd). A tutorial for GNU libmicrohttpd. ++* libmicrohttpdtutorial: (microhttpd). A tutorial for GNU libmicrohttpd + @end direntry + + @copying ================================================================ Index: packages/libmicrohttpd/libmicrohttpd-missing-files.patch diff -u /dev/null packages/libmicrohttpd/libmicrohttpd-missing-files.patch:1.1 --- /dev/null Sun Nov 6 06:47:30 2011 +++ packages/libmicrohttpd/libmicrohttpd-missing-files.patch Sun Nov 6 06:47:25 2011 @@ -0,0 +1,825 @@ +--- libmicrohttpd-0.9.16/doc/chapters/sessions.inc.orig 1970-01-01 01:00:00.000000000 +0100 ++++ libmicrohttpd-0.9.16/doc/chapters/sessions.inc 2011-11-06 06:41:40.346690352 +0100 +@@ -0,0 +1,71 @@ ++This chapter discusses how one should manage sessions, that is, share state between multiple ++HTTP requests from the same user. We use a simple example where the user submits multiple ++forms and the server is supposed to accumulate state from all of these forms. Naturally, as ++this is a network protocol, our session mechanism must support having many users with ++many concurrent sessions at the same time. ++ ++In order to track users, we use a simple session cookie. A session cookie expires when the ++user closes the browser. Changing from session cookies to persistent cookies only requires ++adding an expiration time to the cookie. The server creates a fresh session cookie whenever ++a request without a cookie is received, or if the supplied session cookie is not known to ++the server. ++ ++@heading Looking up the cookie ++ ++Since MHD parses the HTTP cookie header for us, looking up an existing cookie ++is straightforward: ++ ++@verbatim ++FIXME. ++@end verbatim ++ ++Here, FIXME is the name we chose for our session cookie. ++ ++ ++@heading Setting the cookie header ++ ++MHD requires the user to provide the full cookie format string in order to set ++cookies. In order to generate a unique cookie, our example creates a random ++64-character text string to be used as the value of the cookie: ++ ++@verbatim ++FIXME. ++@end verbatim ++ ++Given this cookie value, we can then set the cookie header in our HTTP response ++as follows: ++ ++@verbatim ++FIXME. ++@end verbatim ++ ++ ++@heading Remark: Session expiration ++ ++It is of course possible that clients stop their interaction with the ++server at any time. In order to avoid using too much storage, the ++server must thus discard inactive sessions at some point. Our example ++implements this by discarding inactive sessions after a certain amount ++of time. Alternatively, the implementation may limit the total number ++of active sessions. Which bounds are used for idle sessions or the ++total number of sessions obviously depends largely on the type of ++the application and available server resources. ++ ++@heading Example code ++ ++A sample application implementing a website with multiple ++forms (which are dynamically created using values from previous ++POST requests from the same session) is available ++as the example @code{sessions.c}. ++ ++Note that the example uses a simple, $O(n)$ linked list traversal to ++look up sessions and to expire old sessions. Using a hash table and a ++heap would be more appropriate if a large number of concurrent ++sessions is expected. ++ ++@heading Remarks ++ ++Naturally, it is quite conceivable to store session data in a database ++instead of in memory. Still, having mechanisms to expire data ++associated with long-time idle sessions (where the business process ++has still not finished) is likely a good idea. +--- libmicrohttpd-0.9.16/doc/examples/sessions.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ libmicrohttpd-0.9.16/doc/examples/sessions.c 2011-11-06 06:41:35.430023520 +0100 +@@ -0,0 +1,748 @@ ++/* ++ This file is part of libmicrohttpd ++ (C) 2011 Christian Grothoff (and other contributing authors) ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++*/ ++/** ++ * @file post_example.c ++ * @brief example for processing POST requests using libmicrohttpd ++ * @author Christian Grothoff ++ */ ++ ++/* needed for asprintf */ ++#define _GNU_SOURCE ++ ++ ++#include <stdlib.h> ++#include <string.h> ++#include <stdio.h> ++#include <errno.h> ++#include <time.h> ++#include <microhttpd.h> ++ ++/** ++ * Invalid method page. ++ */ ++#define METHOD_ERROR "<html><head><title>Illegal request</title></head><body>Go away.</body></html>" ++ ++/** ++ * Invalid URL page. ++ */ ++#define NOT_FOUND_ERROR "<html><head><title>Not found</title></head><body>Go away.</body></html>" ++ ++/** ++ * Front page. (/) ++ */ ++#define MAIN_PAGE "<html><head><title>Welcome</title></head><body><form action=\"/2\" method=\"post\">What is your name? <input type=\"text\" name=\"v1\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>" ++ ++/** ++ * Second page. (/2) ++ */ ++#define SECOND_PAGE "<html><head><title>Tell me more</title></head><body><a href=\"/\">previous</a> <form action=\"/S\" method=\"post\">%s, what is your job? <input type=\"text\" name=\"v2\" value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>" ++ ++/** ++ * Second page (/S) ++ */ ++#define SUBMIT_PAGE "<html><head><title>Ready to submit?</title></head><body><form action=\"/F\" method=\"post\"><a href=\"/2\">previous </a> <input type=\"hidden\" name=\"DONE\" value=\"yes\" /><input type=\"submit\" value=\"Submit\" /></body></html>" ++ ++/** ++ * Last page. ++ */ ++#define LAST_PAGE "<html><head><title>Thank you</title></head><body>Thank you.</body></html>" ++ ++/** ++ * Name of our cookie. ++ */ ++#define COOKIE_NAME "session" ++ ++ ++/** ++ * State we keep for each user/session/browser. ++ */ ++struct Session ++{ ++ /** ++ * We keep all sessions in a linked list. ++ */ ++ struct Session *next; ++ ++ /** ++ * Unique ID for this session. ++ */ ++ char sid[33]; ++ ++ /** ++ * Reference counter giving the number of connections ++ * currently using this session. ++ */ ++ unsigned int rc; ++ ++ /** ++ * Time when this session was last active. ++ */ ++ time_t start; ++ ++ /** ++ * String submitted via form. ++ */ ++ char value_1[64]; ++ ++ /** ++ * Another value submitted via form. ++ */ ++ char value_2[64]; ++ ++}; ++ ++ ++/** ++ * Data kept per request. ++ */ ++struct Request ++{ ++ ++ /** ++ * Associated session. ++ */ ++ struct Session *session; ++ ++ /** ++ * Post processor handling form data (IF this is ++ * a POST request). ++ */ ++ struct MHD_PostProcessor *pp; ++ ++ /** ++ * URL to serve in response to this POST (if this request ++ * was a 'POST') ++ */ ++ const char *post_url; ++ ++}; ++ ++ ++/** ++ * Linked list of all active sessions. Yes, O(n) but a ++ * hash table would be overkill for a simple example... ++ */ ++static struct Session *sessions; ++ ++ ++ ++ ++/** ++ * Return the session handle for this connection, or ++ * create one if this is a new user. ++ */ ++static struct Session * ++get_session (struct MHD_Connection *connection) ++{ ++ struct Session *ret; ++ const char *cookie; ++ ++ cookie = MHD_lookup_connection_value (connection, ++ MHD_COOKIE_KIND, ++ COOKIE_NAME); ++ if (cookie != NULL) ++ { ++ /* find existing session */ ++ ret = sessions; ++ while (NULL != ret) ++ { ++ if (0 == strcmp (cookie, ret->sid)) ++ break; ++ ret = ret->next; ++ } ++ if (NULL != ret) ++ { ++ ret->rc++; ++ return ret; ++ } ++ } ++ /* create fresh session */ ++ ret = calloc (1, sizeof (struct Session)); ++ if (NULL == ret) ++ { ++ fprintf (stderr, "calloc error: %s\n", strerror (errno)); ++ return NULL; ++ } ++ /* not a super-secure way to generate a random session ID, ++ but should do for a simple example... */ ++ snprintf (ret->sid, ++ sizeof (ret->sid), ++ "%X%X%X%X", ++ (unsigned int) random (), ++ (unsigned int) random (), ++ (unsigned int) random (), ++ (unsigned int) random ()); ++ ret->rc++; ++ ret->start = time (NULL); ++ ret->next = sessions; ++ sessions = ret; ++ return ret; ++} ++ ++ ++/** ++ * Type of handler that generates a reply. ++ * ++ * @param cls content for the page (handler-specific) ++ * @param mime mime type to use ++ * @param session session information ++ * @param connection connection to process ++ * @param MHD_YES on success, MHD_NO on failure ++ */ ++typedef int (*PageHandler)(const void *cls, ++ const char *mime, ++ struct Session *session, ++ struct MHD_Connection *connection); ++ ++ ++/** ++ * Entry we generate for each page served. ++ */ ++struct Page ++{ ++ /** ++ * Acceptable URL for this page. ++ */ ++ const char *url; ++ ++ /** ++ * Mime type to set for the page. ++ */ ++ const char *mime; ++ ++ /** ++ * Handler to call to generate response. ++ */ ++ PageHandler handler; ++ ++ /** ++ * Extra argument to handler. ++ */ ++ const void *handler_cls; ++}; ++ ++ ++/** ++ * Add header to response to set a session cookie. ++ * ++ * @param session session to use ++ * @param response response to modify ++ */ ++static void ++add_session_cookie (struct Session *session, ++ struct MHD_Response *response) ++{ ++ char cstr[256]; ++ snprintf (cstr, ++ sizeof (cstr), ++ "%s=%s", ++ COOKIE_NAME, ++ session->sid); ++ if (MHD_NO == ++ MHD_add_response_header (response, ++ MHD_HTTP_HEADER_SET_COOKIE, ++ cstr)) ++ { ++ fprintf (stderr, ++ "Failed to set session cookie header!\n"); ++ } ++} ++ ++ ++/** ++ * Handler that returns a simple static HTTP page that ++ * is passed in via 'cls'. ++ * ++ * @param cls a 'const char *' with the HTML webpage to return ++ * @param mime mime type to use ++ * @param session session handle ++ * @param connection connection to use ++ */ ++static int ++serve_simple_form (const void *cls, ++ const char *mime, ++ struct Session *session, ++ struct MHD_Connection *connection) ++{ ++ int ret; ++ const char *form = cls; ++ struct MHD_Response *response; ++ ++ /* return static form */ ++ response = MHD_create_response_from_buffer (strlen (form), ++ (void *) form, ++ MHD_RESPMEM_PERSISTENT); ++ add_session_cookie (session, response); ++ MHD_add_response_header (response, ++ MHD_HTTP_HEADER_CONTENT_ENCODING, ++ mime); ++ ret = MHD_queue_response (connection, ++ MHD_HTTP_OK, ++ response); ++ MHD_destroy_response (response); ++ return ret; ++} ++ ++ ++/** ++ * Handler that adds the 'v1' value to the given HTML code. ++ * ++ * @param cls a 'const char *' with the HTML webpage to return ++ * @param mime mime type to use ++ * @param session session handle ++ * @param connection connection to use ++ */ ++static int ++fill_v1_form (const void *cls, ++ const char *mime, ++ struct Session *session, ++ struct MHD_Connection *connection) ++{ ++ int ret; ++ const char *form = cls; ++ char *reply; ++ struct MHD_Response *response; ++ ++ if (-1 == asprintf (&reply, ++ form, ++ session->value_1)) ++ { ++ /* oops */ ++ return MHD_NO; ++ } ++ /* return static form */ ++ response = MHD_create_response_from_buffer (strlen (reply), ++ (void *) reply, ++ MHD_RESPMEM_MUST_FREE); ++ add_session_cookie (session, response); ++ MHD_add_response_header (response, ++ MHD_HTTP_HEADER_CONTENT_ENCODING, ++ mime); ++ ret = MHD_queue_response (connection, ++ MHD_HTTP_OK, ++ response); ++ MHD_destroy_response (response); ++ return ret; ++} ++ ++ ++/** ++ * Handler that adds the 'v1' and 'v2' values to the given HTML code. ++ * ++ * @param cls a 'const char *' with the HTML webpage to return ++ * @param mime mime type to use ++ * @param session session handle ++ * @param connection connection to use ++ */ ++static int ++fill_v1_v2_form (const void *cls, ++ const char *mime, ++ struct Session *session, ++ struct MHD_Connection *connection) ++{ ++ int ret; ++ const char *form = cls; ++ char *reply; ++ struct MHD_Response *response; ++ ++ if (-1 == asprintf (&reply, ++ form, ++ session->value_1, ++ session->value_2)) ++ { ++ /* oops */ ++ return MHD_NO; ++ } ++ /* return static form */ ++ response = MHD_create_response_from_buffer (strlen (reply), ++ (void *) reply, ++ MHD_RESPMEM_MUST_FREE); ++ add_session_cookie (session, response); ++ MHD_add_response_header (response, ++ MHD_HTTP_HEADER_CONTENT_ENCODING, ++ mime); ++ ret = MHD_queue_response (connection, ++ MHD_HTTP_OK, ++ response); ++ MHD_destroy_response (response); ++ return ret; ++} ++ ++ ++/** ++ * Handler used to generate a 404 reply. ++ * ++ * @param cls a 'const char *' with the HTML webpage to return ++ * @param mime mime type to use ++ * @param session session handle ++ * @param connection connection to use ++ */ ++static int ++not_found_page (const void *cls, ++ const char *mime, ++ struct Session *session, ++ struct MHD_Connection *connection) <<Diff was trimmed, longer than 597 lines>> ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libmicrohttpd/libmicrohttpd.spec?r1=1.16&r2=1.17&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
