From a6aa3711668247c660699cd285d5bfffaa739324 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Thu, 4 Jan 2024 01:04:04 +0100 Subject: [PATCH] minisoap.c: Content type with charset=utf-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UPnP Device Architecture 1.0 (3.2.1 p48) CONTENT-TYPE Required. Must be text/xml. Should include character coding used, which must be “utf-8”. UPnP Device Architecture 1.1 (3.2.1 p75) CONTENT-TYPE REQUIRED. Field value MUST be “text/xml; charset="utf-8" ” --- miniupnpc/Changelog.txt | 5 ++++- miniupnpc/miniupnpcstrings.h.cmake | 4 ++++ miniupnpc/miniupnpcstrings.h.in | 6 +++++- miniupnpc/src/minisoap.c | 6 +++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/miniupnpc/Changelog.txt b/miniupnpc/Changelog.txt index 831b40c..cba2e63 100644 --- a/miniupnpc/Changelog.txt +++ b/miniupnpc/Changelog.txt @@ -1,6 +1,9 @@ -$Id: Changelog.txt,v 1.259 2023/06/15 22:42:36 nanard Exp $ +$Id: Changelog.txt,v 1.260 2024/01/04 00:32:52 nanard Exp $ miniUPnP client Changelog. +2024/01/04: + includes charset="utf-8" in Content-Type + 2023/06/15: Make User-Agent compliant. listdevices => upnp-listdevices diff --git a/miniupnpc/miniupnpcstrings.h.cmake b/miniupnpc/miniupnpcstrings.h.cmake index 78c8fe9..4b7a9f6 100644 --- a/miniupnpc/miniupnpcstrings.h.cmake +++ b/miniupnpc/miniupnpcstrings.h.cmake @@ -6,9 +6,13 @@ #if 0 /* according to "UPnP Device Architecture 1.0" */ +#define UPNP_VERSION_MAJOR 1 +#define UPNP_VERSION_MINOR 0 #define UPNP_VERSION_STRING "UPnP/1.0" #else /* according to "UPnP Device Architecture 1.1" */ +#define UPNP_VERSION_MAJOR 1 +#define UPNP_VERSION_MINOR 1 #define UPNP_VERSION_STRING "UPnP/1.1" #endif diff --git a/miniupnpc/miniupnpcstrings.h.in b/miniupnpc/miniupnpcstrings.h.in index 68bf429..5a974bd 100644 --- a/miniupnpc/miniupnpcstrings.h.in +++ b/miniupnpc/miniupnpcstrings.h.in @@ -1,4 +1,4 @@ -/* $Id: miniupnpcstrings.h.in,v 1.6 2014/11/04 22:31:55 nanard Exp $ */ +/* $Id: miniupnpcstrings.h.in,v 1.7 2023/07/05 22:43:50 nanard Exp $ */ /* Project: miniupnp * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * Author: Thomas Bernard @@ -13,9 +13,13 @@ #if 0 /* according to "UPnP Device Architecture 1.0" */ +#define UPNP_VERSION_MAJOR 1 +#define UPNP_VERSION_MINOR 0 #define UPNP_VERSION_STRING "UPnP/1.0" #else /* according to "UPnP Device Architecture 1.1" */ +#define UPNP_VERSION_MAJOR 1 +#define UPNP_VERSION_MINOR 1 #define UPNP_VERSION_STRING "UPnP/1.1" #endif diff --git a/miniupnpc/src/minisoap.c b/miniupnpc/src/minisoap.c index 5967ca2..903ac5f 100644 --- a/miniupnpc/src/minisoap.c +++ b/miniupnpc/src/minisoap.c @@ -1,4 +1,4 @@ -/* $Id: minisoap.c,v 1.31 2023/06/15 21:47:50 nanard Exp $ */ +/* $Id: minisoap.c,v 1.32 2023/07/05 22:43:50 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * Project : miniupnp * Author : Thomas Bernard @@ -92,7 +92,11 @@ int soapPostSubmit(SOCKET fd, "Host: %s%s\r\n" "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n" "Content-Length: %d\r\n" +#if (UPNP_VERSION_MAJOR == 1) && (UPNP_VERSION_MINOR == 0) "Content-Type: text/xml\r\n" +#else + "Content-Type: text/xml; charset=\"utf-8\"\r\n" +#endif "SOAPAction: \"%s\"\r\n" "Connection: Close\r\n" "Cache-Control: no-cache\r\n" /* ??? */