From e0ad9f7e269f9b10e6e310883c4e454575e97dab Mon Sep 17 00:00:00 2001 From: Jamiras <32680403+Jamiras@users.noreply.github.com> Date: Thu, 23 Dec 2021 11:30:35 -0700 Subject: [PATCH] fix netplay UPNP binding for specific router behavior (#13399) * fix netplay UPNP binding for specific router behavior * use ISSPACE macro --- libretro-common/formats/xml/rxml.c | 1 + libretro-common/net/net_http.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libretro-common/formats/xml/rxml.c b/libretro-common/formats/xml/rxml.c index 73daddb7f4..1c2caeabba 100644 --- a/libretro-common/formats/xml/rxml.c +++ b/libretro-common/formats/xml/rxml.c @@ -197,6 +197,7 @@ rxml_document_t *rxml_load_document_string(const char *str) node->name = strdup(x.elem); attr = NULL; + valptr = buf->val; ++level; break; diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 0ed933ae60..3ad2cccdf5 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -919,11 +919,14 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total) } else { - if (string_starts_with_case_insensitive(state->data, "Content-Length: ")) + if (string_starts_with_case_insensitive(state->data, "Content-Length:")) { + char* ptr = state->data + STRLEN_CONST("Content-Length:"); + while (ISSPACE(*ptr)) + ++ptr; + state->bodytype = T_LEN; - state->len = strtol(state->data + - STRLEN_CONST("Content-Length: "), NULL, 10); + state->len = strtol(ptr, NULL, 10); } if (string_is_equal_case_insensitive(state->data, "Transfer-Encoding: chunked")) state->bodytype = T_CHUNK;