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

Kotlin ios misses last 2 bytes #920

Closed
flaquir4 opened this issue Feb 1, 2019 · 4 comments
Closed

Kotlin ios misses last 2 bytes #920

flaquir4 opened this issue Feb 1, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@flaquir4
Copy link

flaquir4 commented Feb 1, 2019

Ktor Version

1.1.2

Ktor Engine Used(client or server and name)

io.ktor:ktor-client-ios

JVM Version, Operating System and Relevant Context

kotlin 1.3.20

Feedback

I have a network call which randomly drops 2 bytes it only happens sometimes.
In ktor/jvm works fine.
Do you know what the issue can be?

@e5l e5l self-assigned this Feb 1, 2019
@e5l e5l added the bug label Feb 1, 2019
@e5l
Copy link
Member

e5l commented Feb 1, 2019

Hi @flaquir4, thanks for the report.
I can't reproduce, could you provide the request URL?

@flaquir4
Copy link
Author

flaquir4 commented Feb 1, 2019

Unfortunately I can't it's a private API.

EDIT:

I have found a workaround.
It seems that readbytes() does not actually read all remaining bytes so I force to read remaining bytes.

    var readBytes = readBytes()
    var stringResponse = stringFromUtf8Bytes(readBytes)
    while(this.content.availableForRead != 0) {
        readBytes = this.readBytes()
        stringResponse += stringFromUtf8Bytes (readBytes)
    }

@e5l
Copy link
Member

e5l commented Feb 5, 2019

Fixed by Kotlin/kotlinx-io#36

@cy6erGn0m cy6erGn0m added this to the 1.1.3 milestone Feb 20, 2019
@cy6erGn0m
Copy link
Contributor

Fixed in 1.1.3.

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

No branches or pull requests

3 participants