Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

The URL parameter with Chinese characters comes to the upstream proxy like this "????" #931

Open
dimansound opened this issue Oct 14, 2022 · 3 comments

Comments

@dimansound
Copy link

Broken url parameter comes to upstream proxy when use UpStreamHttpProxy and Chinese characters in url params, for example any url with this params:

&systemCode=附件系统
or
&systemCode=%E9%99%84%E4%BB%B6%E7%B3%BB%E7%BB%9F

On the upstream proxy got &systemCode=????
image
BeforeRequest by default, hasn't code.
Without UpStreamHttpProxy works well done.
Titanium version 3.1.1450

@dimansound
Copy link
Author

image

@honfika
Copy link
Collaborator

honfika commented Dec 25, 2022

Do you change the url (or the query string ) in TWP?
I tried to repducuce the issue, but can't ... however I did not change anything in TWP
chrome => TWP => Fiddler => server works:

Browser:
image

Upstream Http proxy (Fiddler):
image

So please specify what did you do in your application.

@dimansound
Copy link
Author

dimansound commented Mar 28, 2023

Do you change the url (or the query string ) in TWP?

I changed code url = Request.RequestUri.ToString() to url = Request.RequestUriString;
Request.RequestUri.ToString() got ?systemCode=附件系统
Request.RequestUriString got ?systemCode=%E9%99%84%E4%BB%B6%E7%B3%BB%E7%BB%9F
Otherwise, this is what happens:
In original code TWP v3.2 in HttpWebClient.cs used this method (condition when useUpstreamProxy = true)
url = Request.RequestUri.ToString();
So this method returned not urlencoded value of url http://.../?systemCode=附件系统
Next step in method headerBuilder.WriteRequestLine(Request.Method, url, Request.HttpVersion);

image

image

As a result, due to the fact that Request.RequestUri.ToString() returns an unencoded value, when encoding, the result is encoding.GetBytes(str) = "????", that is, instead of Chinese characters, since ISO-8859-1 is used, Chinese characters are encoded as the character "?"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants