Skip to content

fix bug: upload more than 2 files in a single post request will be failed #414

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

Merged
merged 1 commit into from
Dec 28, 2013

Conversation

kailunio
Copy link

In the function getTotalLength, the length of a single file lost 2 bytes because of the CR_LF.
When uploading 1 file in a single post request, lost 2 bytes, the CR_LF will not be sent.
When uploading 2 file in a single post request, lost 4 bytes, the substring in file split "--" will not be sent.
When uploading more than 2 file in a single post request, lost more than 4 bytes, the last file split will not be complete any more. The server will show an error.

@smarek
Copy link
Member

smarek commented Dec 28, 2013

@realxu great, thank you for noticing this, I haven't got time to look at it yet. But if the bug behaves as you describe, won't that cause problems in 1-2 files usage? I'd expect some conditions on which add the CR_LF length to stream length.

@ghost ghost assigned smarek Dec 28, 2013
smarek added a commit that referenced this pull request Dec 28, 2013
Wrong length calculated when uploading files, Closing #332
@smarek smarek merged commit 656a244 into android-async-http:master Dec 28, 2013
@kailunio
Copy link
Author

@smarek For example, the correct end of the request may be “--WTLNkQ9EJE-HyCAyHCPmREm5hfbv--\r\n”.
Because of this bug, for 1 file lost 2 bytes:“--WTLNkQ9EJE-HyCAyHCPmREm5hfbv--”, 2 files lost 4 bytes:“--WTLNkQ9EJE-HyCAyHCPmREm5hfbv”. They are both accepted by the web server. But for 3 files, it will lost 6 bytes:"“--WTLNkQ9EJE-HyCAyHCPmREm5hf", and it will not be accepted by the web server.

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 this pull request may close these issues.

2 participants