win32 use binary flag on opening http file
authorAndy Green <andy@warmcat.com>
Sat, 14 May 2011 13:08:00 +0000 (15:08 +0200)
committerAndy Green <andy@warmcat.com>
Sat, 14 May 2011 13:08:00 +0000 (15:08 +0200)
Reported-by: Michel Archambault <marchamb@matrox.com>
Signed-off-by: Andy Green <andy@warmcat.com>
lib/parsers.c

index 94b02fa..165f758 100644 (file)
@@ -1670,7 +1670,11 @@ int libwebsockets_serve_http_file(struct libwebsocket *wsi, const char *file,
        char *p = buf;
        int n;
 
+#ifdef WIN32
+       fd = open(file, O_RDONLY | _O_BINARY);
+#else
        fd = open(file, O_RDONLY);
+#endif
        if (fd < 1) {
                p += sprintf(p, "HTTP/1.0 400 Bad\x0d\x0a"
                        "Server: libwebsockets\x0d\x0a"