Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of String type connection links, not just URIs #1374

Open
mister-proger opened this issue Dec 10, 2023 · 0 comments
Open

Allow the use of String type connection links, not just URIs #1374

mister-proger opened this issue Dec 10, 2023 · 0 comments

Comments

@mister-proger
Copy link

In my connection link line, something like this looks like this:
ws://1.1.1.1:1111?<TEXT> instead of <TEXT> there is a string containing the character % just as a character. If I try to convert such a string to a URI, I will get:

2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  java.net.URISyntaxException: Malformed escape pair at index 28: ws://10.242.223.170:8080?ABC%s0A
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.fail(URI.java:2893)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.scanEscape(URI.java:3023)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.scan(URI.java:3046)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.checkChars(URI.java:3064)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.parseHierarchical(URI.java:3156)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI$Parser.parse(URI.java:3098)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at java.net.URI.<init>(URI.java:584)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at com.gct.cl.android.wsconnecter.ConnectionsController$WSRTCDConnector.<init>(ConnectionsController.kt:12)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at com.gct.cl.android.wsconnecter.ConnectionsController.connect(ConnectionsController.kt:42)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at com.gct.cl.android.main.ActivityMain.binder(ActivityMain.kt:112)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at com.gct.cl.android.main.ActivityMain.onCreate(ActivityMain.kt:82)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.Activity.performCreate(Activity.java:8591)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.Activity.performCreate(Activity.java:8570)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4150)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4325)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.os.Handler.dispatchMessage(Handler.java:106)
2023-12-10 22:36:41.650 18152-18152 System.err              com.gct.cl.android                   W  	at android.os.Looper.loopOnce(Looper.java:226)
2023-12-10 22:36:41.651 18152-18152 System.err              com.gct.cl.android                   W  	at android.os.Looper.loop(Looper.java:313)
2023-12-10 22:36:41.651 18152-18152 System.err              com.gct.cl.android                   W  	at android.app.ActivityThread.main(ActivityThread.java:8762)
2023-12-10 22:36:41.651 18152-18152 System.err              com.gct.cl.android                   W  	at java.lang.reflect.Method.invoke(Native Method)
2023-12-10 22:36:41.651 18152-18152 System.err              com.gct.cl.android                   W  	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
2023-12-10 22:36:41.651 18152-18152 System.err              com.gct.cl.android                   W  	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

I can replace % with %25, and perform the same operation on the server side (%25 with %). But in the python library it calmly accepts the % character, and the server (running on your library) will just as calmly accept and process it. I tried using URLEncoder and URLDecoder, but then I need to use the encoder everywhere, but in the same KTor it is not needed.

P. S. URLEncoder and URLDecoder also changed the connection scheme and address, so I immediately dismissed this option.

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

No branches or pull requests

1 participant