internal.c

Go to the documentation of this file.
00001 /*
00002      This file is part of libmicrohttpd
00003      (C) 2007 Daniel Pittman and Christian Grothoff
00004 
00005      This library is free software; you can redistribute it and/or
00006      modify it under the terms of the GNU Lesser General Public
00007      License as published by the Free Software Foundation; either
00008      version 2.1 of the License, or (at your option) any later version.
00009 
00010      This library is distributed in the hope that it will be useful,
00011      but WITHOUT ANY WARRANTY; without even the implied warranty of
00012      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013      Lesser General Public License for more details.
00014 
00015      You should have received a copy of the GNU Lesser General Public
00016      License along with this library; if not, write to the Free Software
00017      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00027 #include "internal.h"
00028 
00029 #if HAVE_MESSAGES
00030 
00034 void
00035 MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
00036 {
00037   va_list va;
00038 
00039   if ((daemon->options & MHD_USE_DEBUG) == 0)
00040     return;
00041   va_start (va, format);
00042   VFPRINTF (stderr, format, va);
00043   va_end (va);
00044 }
00045 #endif
00046 
00050 void
00051 MHD_http_unescape (char *val)
00052 {
00053   char *esc;
00054   unsigned int num;
00055 
00056   while (NULL != (esc = strstr (val, "+")))
00057     *esc = ' ';
00058   while (NULL != (esc = strstr (val, "%")))
00059     {
00060       if ((1 == sscanf (&esc[1],
00061                         "%2x", &num)) || (1 == sscanf (&esc[1], "%2X", &num)))
00062         {
00063           esc[0] = (unsigned char) num;
00064           memmove (&esc[1], &esc[3], strlen (&esc[3]) + 1);
00065         }
00066       val = esc + 1;
00067     }
00068 }

Generated on Fri Oct 3 15:58:28 2008 for GNU libmicrohttpd by  doxygen 1.5.6