HTTP-Header-Live icon indicating copy to clipboard operation
HTTP-Header-Live copied to clipboard

POST Data and percent coding

Open JohnQMetro opened this issue 6 years ago • 4 comments

The displayed POST is not raw, since it seems that individual parts are not percent coded (ex, &//CDSportal=http://cdsportal.u-strasbg.fr/StoreVizierData.html instead of &%2F%2FCDSportal=http%3A%2F%2Fcdsportal.u-strasbg.fr%2FStoreVizierData.html )

So you cannot copy and paste POST data, and then slightly modify and use it. It would be nice to have that option.

JohnQMetro avatar Sep 17 '19 23:09 JohnQMetro

Hello,

sorry for the long response time.

Let me get this straight: You would like a button(?) to automatically decode and encode the POST data?

Nitrama avatar Jan 01 '20 19:01 Nitrama

HTTP-Header-Live, last time I checked, displayed POST data decoded with no way to see it encoded. I wanted a way to show it encoded.

I have been using a modified version of HTTP-Header-Live that does that for a few months now.

JohnQMetro avatar Jan 03 '20 11:01 JohnQMetro

There is a modified version? Is there a possibility that I can have a look at it and if necessary integrate it?

Nitrama avatar Jan 03 '20 14:01 Nitrama

If you want. what I did was pretty simple (and unconditional): I inserted some encoding in the first function in HTTPHeaderSub.js

as below: var TAB_ID = ""; var RESENDED_TAB = false; var RESEND_TAB_NEW = ""; StorageChange();

var repa_sp = new RegExp("%20",'g'); var repa_sq = new RegExp("'",'g'); var repa_rp = new RegExp("\(",'g'); var repa_lp = new RegExp("\)",'g');

function escapeFull(value_in) { var rval = encodeURIComponent(value_in).replace(repa_sp,'+'); return rval.replace(repa_sq,"%27").replace(repa_rp,"%28").replace(repa_lp,"%29"); }

function notify(request) { //console.log(request.data) data = request.data; for (value in data) { //checked if (value == "onBeforeRequest") { document.getElementById("select_method").value = data[value].method; document.getElementById("header_url").value = data[value].url; string = ""; if (data[value].requestBody != undefined) { if (data[value].requestBody.formData != undefined) { for (var i in data[value].requestBody.formData) { var ekey = escapeFull(i); var evalue = escapeFull(data[value].requestBody.formData[i]); string += ekey + "=" + evalue + "&"; } string = string.substr(0, string.length - 1); } else if (data[value].requestBody.raw != undefined) { utf8decode = new TextDecoder("utf-8"); string = utf8decode.decode(data[value].requestBody.raw[0].bytes); } } document.getElementById("post_data").textContent = string; document.getElementById("content_length_label").textContent = chrome.i18n.getMessage("content_length_label") + string.length; } else if (value == "onSendHeaders") { string = ""; for (var i of data[value].requestHeaders) { string += i.name + ": " + i.value + "\r\n"; } document.getElementById("header_data").textContent = string; } else if (value == "onAuthRequired") { } else if (value == "onErrorOccurred") { } } }

I don't really know if you will find this useful. John Metro

Sent from Outlookhttp://aka.ms/weboutlook


From: Martin Antrag [email protected] Sent: January 3, 2020 9:31 AM To: Nitrama/HTTP-Header-Live [email protected] Cc: JohnQMetro [email protected]; Author [email protected] Subject: Re: [Nitrama/HTTP-Header-Live] POST Data and percent coding (#32)

There is a modified version? Is there a possibility that I can have a look at it and if necessary integrate it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Nitrama/HTTP-Header-Live/issues/32?email_source=notifications&email_token=AH3DOADTPIOSIDZMX7D62NTQ35D45A5CNFSM4IXWRVQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIBHXEA#issuecomment-570588048, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH3DOAD2Q4NQ5LYGUO363E3Q35D45ANCNFSM4IXWRVQA.

JohnQMetro avatar Jan 06 '20 22:01 JohnQMetro