File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
dotnet/src/dotnetframework/GxClasses/Domain Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -484,13 +484,19 @@ public string get_ProxyHost()
484484 {
485485 return _proxyHost ;
486486 }
487+ #if NETCORE
488+ private static Encoding ISO_8859_1 = Encoding . Latin1 ;
489+ #else
490+ private static Encoding ISO_8859_1 = Encoding . GetEncoding ( "ISO-8859-1" ) ;
491+ #endif
492+ private const string AuthenticationSchemeBasic = "Basic" ;
487493 public void AddAuthentication ( int scheme , string realm , string user , string password )
488494 {
489495 if ( scheme >= _Basic && scheme <= _Kerberos )
490496 _authCollection . Add ( new GxAuthScheme ( scheme , realm , user , password ) ) ;
491497 if ( scheme == _Basic ) {
492- string authHeader = Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( $ "{ user } :{ password } ") ) ;
493- AddHeader ( HttpHeader . AUTHORIZATION , new AuthenticationHeaderValue ( "Basic" , authHeader ) . ToString ( ) ) ;
498+ string authHeader = Convert . ToBase64String ( ISO_8859_1 . GetBytes ( $ "{ user } :{ password } ") ) ;
499+ AddHeader ( HttpHeader . AUTHORIZATION , new AuthenticationHeaderValue ( AuthenticationSchemeBasic , authHeader ) . ToString ( ) ) ;
494500 }
495501 }
496502
@@ -1036,7 +1042,7 @@ async Task ReadResponseDataAsync()
10361042 }
10371043 }
10381044 }
1039- #endif
1045+ #endif
10401046 bool UseOldHttpClient ( string name )
10411047 {
10421048 if ( Config . GetValueOf ( "useoldhttpclient" , out string useOld ) && useOld . StartsWith ( "y" , StringComparison . OrdinalIgnoreCase ) )
You can’t perform that action at this time.
0 commit comments