From ac91f3fcfcb69ae5684030d708cd3bee6d73b020 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Wed, 31 May 2023 13:33:26 -0400 Subject: [PATCH] 2023-05-31 Fred Gleason * Fixed a regression in 'RDFormPost' that caused the last character of the last variable in the post to be truncated when using 'application/x-www-form-urlencoded' encoding. Signed-off-by: Fred Gleason --- ChangeLog | 4 ++++ lib/rdformpost.cpp | 46 +++++++++++++++++++++++++++++++++++++++++++++- lib/rdformpost.h | 2 ++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8006fbbb..b13b31aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24192,3 +24192,7 @@ * Fixed uninitiated variables in rdairplay(1). 2023-05-30 Fred Gleason * Incremented the package version to 4.0.0rc3int1. +2023-05-31 Fred Gleason + * Fixed a regression in 'RDFormPost' that caused the last character + of the last variable in the post to be truncated when using + 'application/x-www-form-urlencoded' encoding. diff --git a/lib/rdformpost.cpp b/lib/rdformpost.cpp index 197c2323..0b62a6a8 100644 --- a/lib/rdformpost.cpp +++ b/lib/rdformpost.cpp @@ -414,6 +414,50 @@ QString RDFormPost::headerContentType() const } +QByteArray RDFormPost::rawPost() const +{ + return QByteArray(post_data,post_bytes_downloaded); +} + + +QString RDFormPost::parsedPost() const +{ + QString ret=""; + + ret+="\n"; + ret+="\n"; + ret+="\n"; + ret+="\n"; + + ret+="\n"; + ret+="\n"; + ret+="\n"; + ret+="\n"; + ret+="\n"; + + for(QMap::const_iterator ci=post_values.begin(); + ci!=post_values.end();ci++) { + ret+="\n"; + + ret+=QString::asprintf("\n",ci.key().toUtf8().constData()); + ret+=QString::asprintf("\n", + ci.value().toString().toUtf8().constData()); + + if(post_filenames[ci.key()]) { + ret+="\n"; + } + else { + ret+="\n"; + } + ret+="\n"; + } + + ret+="
RDFormPost Data Dump
NAMEVALUEFILE
|%s||%s|YesNo
\n"; + + return ret; +} + + void RDFormPost::dump() { printf("Content-type: text/html\n\n"); @@ -576,7 +620,7 @@ void RDFormPost::LoadUrlEncoding(char first) total_read+=n; } - post_data[total_read]=0; + post_data[total_read+1]=0; lines=QString(post_data).split("&"); for(int i=0;i