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

iOS13 ios-webkit-debug-proxy will disconnected Once the Json is over 200k #344

Closed
liu6x6 opened this issue Dec 24, 2019 · 3 comments · Fixed by #412
Closed

iOS13 ios-webkit-debug-proxy will disconnected Once the Json is over 200k #344

liu6x6 opened this issue Dec 24, 2019 · 3 comments · Fixed by #412

Comments

@liu6x6
Copy link

liu6x6 commented Dec 24, 2019

hi there
today i found an issue on iOS13, and i am using the wdp_client.html to send json string to the safari. Once the JSON size is over than 200KB, then iOS-webkit-debug-proxy will disconnected.

the error logs like:
_

ss.sendq<0x7fb70d504630> new fd=10 recv_fd=14 length=200416, prev=<0x0>
ss.sendq<0x7fb70d504630> disable recv_fd=14
ss.sendq<0x7fb70d504630> resume send to fd=10 len=200416
ssl sendq retry failed: Undefined error: 0
ss.remove_fd(10)
Disconnected :9222 from xiao’s iPhone (9cd6921d1f5f908f06f295b52b0346aacca81234)
ss.remove_server_fd(5)
ss.remove_fd(14)
ss.remove_fd(9)
ss.remove_fd(12)
ss.remove_fd(11)
ss.remove_fd(13)
^Css.remove_server_fd(3)
ss.remove_fd(4)

_

my json command look like:

{"id":8,"method":"Target.sendMessageToTarget","params":{"objectGroup":"console","includeCommandLineAPI":true,"doNotPauseOnExceptionsAndMuteConsole":true,"message":"{"method":"Runtime.evaluate","params":{"expression":"var func = function(){console.debug(\"touch\");console.debug(\"touch\"); ...
;}, true);};func();"},"id":8}","id":8,"targetId":"page-6"}}

I add lot of console.debug(\"touch\"); to make sure the json size is big enough.
it's the SSL problem? how can i fix this?

@liu6x6 liu6x6 changed the title iOS13 ios-webkit-debug-proxy will disconnected Once the Json command is over 200k iOS13 ios-webkit-debug-proxy will disconnected Once the Json is over 200k Dec 24, 2019
@liu6x6
Copy link
Author

liu6x6 commented Jan 6, 2020

After some inverstgation i found there are 2 problems. hope someone can tell me the reason.
The problem is at socket_manager.c sm_send function

  1. Once the data length bigger than 131000 then SSL_write will always return -1
  2. So i split the data size. i send 130000 each time. But the last one (the size is small then 130000) will always return -1, so I add a sleep(1) after the SSL_write. And then it working.

The code like this:
long sendLength = tail - head;
if (sendLength >= 130000) {
sendLength = 130000;
}
sent_bytes = SSL_write((SSL )ssl_session, (void)head, sendLength);
sleep(1);

I am not good at C and ssl. Hope someone could help me.

@artygus
Copy link
Collaborator

artygus commented Jan 13, 2020

hi @liu6x6 interesting observation 🤔 I got back from holidays, will take a look possible this weekend. what OS are you using?

@ElielCohen
Copy link

ElielCohen commented Jan 14, 2020

Hi @artygus , I'm working with @liu6x6 and I've experienced similar issue on any platform, macOS, linux, and windows. The issue is happening as soon as the idevice is running on iOS13+. Any idea what have changed there ? I know that from iOS13+ we are obliged to use SSL for the web inspector communication it's probably linked.

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

Successfully merging a pull request may close this issue.

3 participants