java.lang.IllegalArgumentException when finalising an RTMP publish stream from Flutter library
Closed this issue · 3 comments
Describe the bug
Hello, recently I've discovered that sometimes the opaque parametre contains a space in it's value that will generate a malformed URL.
For this I've used the https://github.com/shogo4405/HaishinKit.dart available for Flutter, but from what I've seen the issue is only reproducing on Android side with the error at the end, that's why this bug is submited directly to the Android project.
W/NetSocketImpl(30031): java.lang.IllegalArgumentException: Illegal character in query at index 122: rtmp://user:passwd@site:1935/mount/?authmod=adobe&user=user&opaque=Qul nQ==&challenge=080f28b6&response=sAUdK5ZAnzX1KKxadxK6zQ==
W/NetSocketImpl(30031): at java.net.URI.create(URI.java:848)
W/NetSocketImpl(30031): at com.haishinkit.rtmp.RtmpConnection.connect(RtmpConnection.kt:220)
W/NetSocketImpl(30031): at com.haishinkit.rtmp.RtmpAuthenticator.handleEvent(RtmpAuthenticator.kt:47)
W/NetSocketImpl(30031): at com.haishinkit.event.EventDispatcher.dispatchEvent(EventDispatcher.kt:37)
W/NetSocketImpl(30031): at com.haishinkit.event.EventDispatcher.dispatchEventWith(EventDispatcher.kt:60)
W/NetSocketImpl(30031): at com.haishinkit.rtmp.message.RtmpCommandMessage.execute(RtmpCommandMessage.kt:81)
W/NetSocketImpl(30031): at com.haishinkit.rtmp.RtmpConnection.listen$haishinkit_release(RtmpConnection.kt:308)
W/NetSocketImpl(30031): at com.haishinkit.rtmp.RtmpSocket.onInput(RtmpSocket.kt:126)
W/NetSocketImpl(30031): at com.haishinkit.net.NetSocketImpl.doInput(NetSocketImpl.kt:107)
W/NetSocketImpl(30031): at com.haishinkit.net.NetSocketImpl.doConnection(NetSocketImpl.kt:167)
W/NetSocketImpl(30031): at com.haishinkit.net.NetSocketImpl.access$doConnection(NetSocketImpl.kt:21)
W/NetSocketImpl(30031): at com.haishinkit.net.NetSocketImpl$connect$1.invokeSuspend(NetSocketImpl.kt:60)
W/NetSocketImpl(30031): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/NetSocketImpl(30031): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/NetSocketImpl(30031): at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
W/NetSocketImpl(30031): at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100)
W/NetSocketImpl(30031): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
W/NetSocketImpl(30031): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
W/NetSocketImpl(30031): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
W/NetSocketImpl(30031): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
W/NetSocketImpl(30031): Caused by: java.net.URISyntaxException: Illegal character in query at index 122: rtmp://user:passwd@site:1935/mount/?authmod=adobe&user=user&opaque=Qul nQ==&challenge=080f28b6&response=sAUdK5ZAnzX1KKxadxK6zQ==
W/NetSocketImpl(30031): at java.net.URI$Parser.fail(URI.java:2893)
W/NetSocketImpl(30031): at java.net.URI$Parser.checkChars(URI.java:3066)
W/NetSocketImpl(30031): at java.net.URI$Parser.parseHierarchical(URI.java:3156)
W/NetSocketImpl(30031): at java.net.URI$Parser.parse(URI.java:3098)
W/NetSocketImpl(30031): at java.net.URI.<init>(URI.java:584)
W/NetSocketImpl(30031): at java.net.URI.create(URI.java:846)
W/NetSocketImpl(30031): ... 19 more
To Reproduce
- Try connecting to any rtmp ingest server, at some point the Exception will be thrown.
Expected behavior
- Opaque parametre shouldn't contain any spaces so it won't produce a malformed URL
Version
Latest version available on https://github.com/shogo4405/HaishinKit.dart
Smartphone info.
No response
Additional context
No response
Screenshots
No response
Relevant log output
No response
I believe I've fixed it with this. Please let me know if there's anything else.
https://github.com/shogo4405/HaishinKit.kt/pull/181/files
Thank you! That does the job!
I confirmed its operation with Wowza, so I merged it.