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

Can Http.Receiving not handle data that is more than 1023 byte? #71

Open
koji-k opened this issue Jul 2, 2020 · 0 comments
Open

Can Http.Receiving not handle data that is more than 1023 byte? #71

koji-k opened this issue Jul 2, 2020 · 0 comments

Comments

@koji-k
Copy link

koji-k commented Jul 2, 2020

I am trying to track size of received data of http response (Http.Receiving).

Elm codes works fine.
But size of Http.Receiving seems to have a problem.

Specifically, size of Http.Receiving will be set Nothing when Content-Length is more than 1023 byte.
If Content-Length smaller than 1024 byte, it is no problem.

I think event.lengthComputable returns false when Content-Length more than 1023 byte.
But i don't know why realize so...

https://github.com/elm/http/blob/master/src/Elm/Kernel/Http.js#L183

I wrote following debug print function execute in update.

printProgress : Http.Progress -> String
printProgress progress =
    case progress of
        Sending record ->
            "Sending: sent=" ++ String.fromInt record.sent

        Receiving record ->
            "Receiving:"
                ++ " received="
                ++ String.fromInt record.received
                ++ ", size="
                ++ (Maybe.withDefault -1 record.size |> String.fromInt)

Result of response with 1023 byte:

  • Chrome: Receiving: received=1023, size=1023: (Loading,<internals>)
  • Firefox: Receiving: received=1023, size=1023: (Loading,<internals>)

Result of response with 1024 byte:

  • Chrome: Receiving: received=1024, size=-1: (Loading,<internals>)
  • Firefox: Receiving: received=134, size=-1: (Loading,<internals>)

received has problem too on Firefox.

Is there something workaround?

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