[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22542 - in libmicrohttpd: . doc/examples src/daemon src/in
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22542 - in libmicrohttpd: . doc/examples src/daemon src/include/plibc |
Date: |
Sun, 8 Jul 2012 15:06:29 +0200 |
Author: grothoff
Date: 2012-07-08 15:06:28 +0200 (Sun, 08 Jul 2012)
New Revision: 22542
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/configure.ac
libmicrohttpd/doc/examples/responseheaders.c
libmicrohttpd/src/daemon/daemon.c
libmicrohttpd/src/include/plibc/plibc.h
Log:
LRN: MHD patches. Later will send patches for other issues, but at least
now it will compile.
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2012-07-07 22:23:59 UTC (rev 22541)
+++ libmicrohttpd/ChangeLog 2012-07-08 13:06:28 UTC (rev 22542)
@@ -1,3 +1,6 @@
+Sun Jul 8 15:05:31 CEST 2012
+ Misc changes to fix build on W32. -LRN
+
Fri Jun 22 11:31:25 CEST 2012
Make sure sockets opened by MHD are non-inheritable by default (#2414).
-CG
Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac 2012-07-07 22:23:59 UTC (rev 22541)
+++ libmicrohttpd/configure.ac 2012-07-08 13:06:28 UTC (rev 22542)
@@ -22,7 +22,7 @@
#
AC_PREREQ(2.57)
AC_INIT([libmicrohttpd], [0.9.20],address@hidden)
-AM_INIT_AUTOMAKE([libmicrohttpd], [0.9.20])
+AM_INIT_AUTOMAKE([silent-rules])
AM_CONFIG_HEADER([MHD_config.h])
AC_CONFIG_MACRO_DIR([m4])
AH_TOP([#define _GNU_SOURCE 1])
Modified: libmicrohttpd/doc/examples/responseheaders.c
===================================================================
--- libmicrohttpd/doc/examples/responseheaders.c 2012-07-07 22:23:59 UTC
(rev 22541)
+++ libmicrohttpd/doc/examples/responseheaders.c 2012-07-08 13:06:28 UTC
(rev 22542)
@@ -37,14 +37,14 @@
MHD_create_response_from_buffer (strlen (errorstr),
(void *) errorstr,
MHD_RESPMEM_PERSISTENT);
- if (response)
+ if (NULL != response)
{
ret =
MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR,
response);
MHD_destroy_response (response);
- return MHD_YES;
+ return ret;
}
else
return MHD_NO;
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2012-07-07 22:23:59 UTC (rev 22541)
+++ libmicrohttpd/src/daemon/daemon.c 2012-07-08 13:06:28 UTC (rev 22542)
@@ -1149,12 +1149,22 @@
if (MHD_YES == need_fcntl)
{
/* make socket non-inheritable */
+#if !WINDOWS
flags = fcntl (s, F_GETFD);
if ( ( (-1 == flags) ||
( (flags != (flags | FD_CLOEXEC)) &&
(0 != fcntl (s, F_SETFD, flags | FD_CLOEXEC)) ) ) )
+#else
+ DWORD dwFlags;
+ if (!GetHandleInformation ((HANDLE) s, &dwFlags) ||
+ ((dwFlags != dwFlags & ~HANDLE_FLAG_INHERIT) &&
+ !SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0)))
+#endif
{
#if HAVE_MESSAGES
+#if WINDOWS
+ SetErrnoFromWinError (GetLastError ());
+#endif
FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n",
STRERROR (errno));
#endif
@@ -1993,35 +2003,54 @@
int ctype = SOCK_STREAM | sock_cloexec;
int fd;
int flags;
+#if WINDOWS
+ DWORD dwFlags;
+#endif
/* use SOCK_STREAM rather than ai_socktype: some getaddrinfo
* implementations do not set ai_socktype, e.g. RHL6.2. */
- fd = socket(domain, ctype, protocol);
+ fd = SOCKET(domain, ctype, protocol);
if ( (-1 == fd) && (EINVAL == errno) && (0 != sock_cloexec) )
{
sock_cloexec = 0;
- fd = socket(domain, type, protocol);
+ fd = SOCKET(domain, type, protocol);
}
if (-1 == fd)
return -1;
if (0 != sock_cloexec)
return fd; /* this is it */
/* flag was not set during 'socket' call, let's try setting it manually */
+#if !WINDOWS
flags = fcntl (fd, F_GETFD);
if (flags < 0)
+#else
+ if (!GetHandleInformation ((HANDLE) fd, &dwFlags))
+#endif
{
#if HAVE_MESSAGES
+#if WINDOWS
+ SetErrnoFromWinError (GetLastError ());
+#endif
FPRINTF(stderr, "Failed to get socket options to make socket
non-inheritable: %s\n",
STRERROR (errno));
#endif
return fd; /* good luck */
}
+#if !WINDOWS
if (flags == (flags | FD_CLOEXEC))
return fd; /* already set */
flags |= FD_CLOEXEC;
if (0 != fcntl (fd, F_SETFD, flags))
+#else
+ if (dwFlags != dwFlags | HANDLE_FLAG_INHERIT)
+ return fd; /* already unset */
+ if (!SetHandleInformation ((HANDLE) fd, HANDLE_FLAG_INHERIT, 0))
+#endif
{
#if HAVE_MESSAGES
+#if WINDOWS
+ SetErrnoFromWinError (GetLastError ());
+#endif
FPRINTF(stderr, "Failed to make socket non-inheritable: %s\n",
STRERROR (errno));
#endif
@@ -2804,7 +2833,7 @@
mhd_panic_cls = NULL;
#ifdef WINDOWS
- plibc_init ("GNU", "libmicrohttpd");
+ plibc_init_utf8 ("GNU", "libmicrohttpd", 1);
#endif
#if HTTPS_SUPPORT
gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
Modified: libmicrohttpd/src/include/plibc/plibc.h
===================================================================
--- libmicrohttpd/src/include/plibc/plibc.h 2012-07-07 22:23:59 UTC (rev
22541)
+++ libmicrohttpd/src/include/plibc/plibc.h 2012-07-08 13:06:28 UTC (rev
22542)
@@ -22,7 +22,7 @@
* @brief PlibC header
* @attention This file is usually not installed under Unix,
* so ship it with your application
- * @version $Revision: 69 $
+ * @version $Revision: 87 $
*/
#ifndef _PLIBC_H_
@@ -50,8 +50,8 @@
#include "langinfo.h"
#endif
+#include <ws2tcpip.h>
#include <windows.h>
-#include <ws2tcpip.h>
#include <sys/types.h>
#include <time.h>
#include <stdio.h>
@@ -70,7 +70,7 @@
/* Convert LARGE_INTEGER to double */
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
(double)((x).LowPart))
-
+#ifndef __MINGW64__
struct stat64
{
_dev_t st_dev;
@@ -85,7 +85,7 @@
__time64_t st_mtime;
__time64_t st_ctime;
};
-
+#endif
typedef unsigned int sa_family_t;
struct sockaddr_un {
@@ -226,8 +226,13 @@
#define MAP_SHARED 0x1
#define MAP_PRIVATE 0x2 /* unsupported */
#define MAP_FIXED 0x10
+#define MAP_ANONYMOUS 0x20 /* unsupported */
#define MAP_FAILED ((void *)-1)
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+
struct statfs
{
long f_type; /* type of filesystem (see below) */
@@ -331,17 +336,29 @@
#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
+BOOL _plibc_CreateShortcutW(const wchar_t *pwszSrc, const wchar_t *pwszDest);
BOOL _plibc_DereferenceShortcut(char *pszShortcut);
+BOOL _plibc_DereferenceShortcutW(wchar_t *pwszShortcut);
char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
+wchar_t *plibc_ChooseDirW(wchar_t *pwszTitle, unsigned long ulFlags);
char *plibc_ChooseFile(char *pszTitle, unsigned long ulFlags);
-long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey,
+wchar_t *plibc_ChooseFileW(wchar_t *pwszTitle, unsigned long ulFlags);
+
+long QueryRegistry(HKEY hMainKey, const char *pszKey, const char *pszSubKey,
char *pszBuffer, long *pdLength);
+long QueryRegistryW(HKEY hMainKey, const wchar_t *pszKey, const wchar_t
*pszSubKey,
+ wchar_t *pszBuffer, long *pdLength);
BOOL __win_IsHandleMarkedAsBlocking(int hHandle);
void __win_SetHandleBlockingMode(int s, BOOL bBlocking);
void __win_DiscardHandleBlockingMode(int s);
int _win_isSocketValid(int s);
int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
+int plibc_conv_to_win_pathw(const wchar_t *pszUnix, wchar_t *pwszWindows);
+
+int plibc_conv_to_win_pathwconv(const char *pszUnix, wchar_t *pwszWindows);
+int plibc_conv_to_win_pathwconv_ex(const char *pszUnix, wchar_t *pszWindows,
int derefLinks);
+
unsigned plibc_get_handle_count();
typedef void (*TPanicProc) (int, char *);
@@ -360,18 +377,25 @@
int mkstemp(char *tmplate);
char *strptime (const char *buf, const char *format, struct tm *tm);
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
+#ifndef gmtime_r
+struct tm *gmtime_r(const time_t *clock, struct tm *result);
+#endif
int plibc_init(char *pszOrg, char *pszApp);
+int plibc_init_utf8(char *pszOrg, char *pszApp, int utf8_mode);
void plibc_shutdown();
int plibc_initialized();
-int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int
derefLinks);
+
void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
void SetErrnoFromWinsockError(long lWinError);
void SetHErrnoFromWinError(long lWinError);
void SetErrnoFromHRESULT(HRESULT hRes);
int GetErrnoFromWinsockError(long lWinError);
FILE *_win_fopen(const char *filename, const char *mode);
+int _win_fclose(FILE *);
DIR *_win_opendir(const char *dirname);
+struct dirent *_win_readdir(DIR *dirp);
+int _win_closedir(DIR *dirp);
int _win_open(const char *filename, int oflag, ...);
#ifdef ENABLE_NLS
char *_win_bindtextdomain(const char *domainname, const char *dirname);
@@ -405,25 +429,56 @@
int _win_symlink(const char *path1, const char *path2);
void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
unsigned long long offset);
+int _win_msync(void *start, size_t length, int flags);
int _win_munmap(void *start, size_t length);
int _win_lstat(const char *path, struct stat *buf);
int _win_lstat64(const char *path, struct stat64 *buf);
int _win_readlink(const char *path, char *buf, size_t bufsize);
int _win_accept(int s, struct sockaddr *addr, int *addrlen);
+
int _win_printf(const char *format,...);
+int _win_wprintf(const wchar_t *format, ...);
+
int _win_fprintf(FILE *f,const char *format,...);
+int _win_fwprintf(FILE *f,const wchar_t *format, ...);
+
int _win_vprintf(const char *format, va_list ap);
+int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vwprintf(const wchar_t *format, va_list ap);
+
int _win_vsprintf(char *dest,const char *format, va_list arg_ptr);
+int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr);
+
int _win_vsnprintf(char* str, size_t size, const char *format, va_list
arg_ptr);
+int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list
arg_ptr);
+
int _win_snprintf(char *str,size_t size,const char *format,...);
+int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...);
+
int _win_sprintf(char *dest,const char *format,...);
+int _win_swprintf(wchar_t *dest, const wchar_t *format, ...);
+
int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
+int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr);
+
int _win_sscanf(const char *str, const char *format, ...);
+int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...);
+
int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr);
+
int _win_vscanf(const char *format, va_list arg_ptr);
+int _win_vwscanf(const wchar_t *format, va_list arg_ptr);
+
int _win_scanf(const char *format, ...);
+int _win_wscanf(const wchar_t *format, ...);
+
int _win_fscanf(FILE *stream, const char *format, ...);
+int _win_fwscanf(FILE *stream, const wchar_t *format, ...);
+
+
pid_t _win_waitpid(pid_t pid, int *stat_loc, int options);
int _win_bind(int s, const struct sockaddr *name, int namelen);
int _win_connect(int s,const struct sockaddr *name, int namelen);
@@ -461,10 +516,12 @@
#endif
char *stpcpy(char *dest, const char *src);
char *strcasestr(const char *haystack_start, const char *needle_start);
-
+#ifndef __MINGW64__
#define strcasecmp(a, b) stricmp(a, b)
+#define wcscasecmp(a, b) wcsicmp(a, b)
#define strncasecmp(a, b, c) strnicmp(a, b, c)
-
+#define wcsncasecmp(a, b, c) wcsnicmp(a, b, c)
+#endif
#endif /* WINDOWS */
#ifndef WINDOWS
@@ -482,8 +539,11 @@
#define CTIME_R(c, b) ctime_r(c, b)
#undef FOPEN
#define FOPEN(f, m) fopen(f, m)
+ #define FCLOSE(f) fclose(f)
#define FTRUNCATE(f, l) ftruncate(f, l)
#define OPENDIR(d) opendir(d)
+ #define CLOSEDIR(d) closedir(d)
+ #define READDIR(d) readdir(d)
#define OPEN open
#define CHDIR(d) chdir(d)
#define CLOSE(f) close(f)
@@ -506,6 +566,8 @@
#define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
#define SYMLINK(a, b) symlink(a, b)
#define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) mkfifo(p, m)
+ #define MSYNC(s, l, f) msync(s, l, f)
#define MUNMAP(s, l) munmap(s, l)
#define STRERROR(i) strerror(i)
#define RANDOM() random()
@@ -575,8 +637,11 @@
#define PLIBC_CTIME(c) _win_ctime(c)
#define CTIME_R(c, b) _win_ctime_r(c, b)
#define FOPEN(f, m) _win_fopen(f, m)
+ #define FCLOSE(f) _win_fclose(f)
#define FTRUNCATE(f, l) _win_ftruncate(f, l)
#define OPENDIR(d) _win_opendir(d)
+ #define CLOSEDIR(d) _win_closedir(d)
+ #define READDIR(d) _win_readdir(d)
#define OPEN _win_open
#define CHDIR(d) _win_chdir(d)
#define CLOSE(f) _win_close(f)
@@ -601,6 +666,8 @@
#define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
#define SYMLINK(a, b) _win_symlink(a, b)
#define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
+ #define MKFIFO(p, m) _win_mkfifo(p, m)
+ #define MSYNC(s, l, f) _win_msync(s, l, f)
#define MUNMAP(s, l) _win_munmap(s, l)
#define STRERROR(i) _win_strerror(i)
#define READLINK(p, b, s) _win_readlink(p, b, s)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22542 - in libmicrohttpd: . doc/examples src/daemon src/include/plibc,
gnunet <=