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

Error when uploading with Transfer-Encoding: chunked #6

Closed
bilogic opened this issue Feb 18, 2023 · 7 comments
Closed

Error when uploading with Transfer-Encoding: chunked #6

bilogic opened this issue Feb 18, 2023 · 7 comments

Comments

@bilogic
Copy link

bilogic commented Feb 18, 2023

PUT /webdav.php/ebook.epub HTTP/1.1
Host: bookfirst.dv1.e115.com
Authorization: Basic YWRtaW46ZmpnaDQ0Mw==
TE: trailers
Transfer-Encoding: chunked
Connection: close, TE
User-Agent: KOReader/2023.01 (https://koreader.rocks/) LuaSocket/3.0.0

800
PK..........!.oa.,............mimetypeapplication/epub+zipPK.........s;T.
...(..AK......ops/f000c-02.jpg.zu\[email protected]..!!
.....*".. ...RPAAA.CD..S%....|......y../8.\u_u...}.s..I...3..	[email protected]...% 	..-.....2.".. ..J......'~.$.].L>.S......)..O...4.....V.a...^.=..X........."Ue..
...5......

I captured the above with tcpdump. it resulted in ebook.pub being a 0 byte file on the server. Any idea? Thank you.

@bilogic bilogic changed the title Error when uploading with Transfer-encoding: chunked Error when uploading with Transfer-Encoding: chunked Feb 18, 2023
@bohwaz
Copy link
Contributor

bohwaz commented Feb 18, 2023 via email

@bilogic
Copy link
Author

bilogic commented Feb 18, 2023

It's Apache/2.4.52 on ubuntu with PHP-FPM

@bohwaz
Copy link
Contributor

bohwaz commented Feb 18, 2023 via email

@bilogic
Copy link
Author

bilogic commented Feb 18, 2023

FPM

@bohwaz
Copy link
Contributor

bohwaz commented Feb 18, 2023

Ah sorry yeah didn't see that you mentioned it first.

I just tested with FPM and it is definitely a bug in Apache mod_fcgid, as reported here:

This has been fixed in 2018, in mod_fcgid 2.3.10:

Unfortunately Debian and Ubuntu are stuck with mod_fcgid: https://tracker.debian.org/pkg/libapache2-mod-fcgid

You can try in CLI like that:

curl -v http://picodav.localhost/test.mp4 -u bohwaz:abcd -T /home/bohwaz/test.mp4 --header "Transfer-Encoding: chunked"

You should either compile your own mod_fcgid or switch over to mod_php. I'll add an error message for FPM when chunked transfer encoding is used.

bohwaz added a commit that referenced this issue Feb 18, 2023
@bohwaz
Copy link
Contributor

bohwaz commented Feb 18, 2023

Thank your for your report, a new error message is generated if this issue is detected, so that zero-length files won't be created.

I contacted the Debian package maintainer and offered a bounty to upload the new mod_fcgid version, so hopefully Debian will get this fixed in next release or even in backports.

@bohwaz bohwaz closed this as completed Feb 18, 2023
@bilogic
Copy link
Author

bilogic commented Feb 18, 2023

Wow, thank you so much! The error report alone is great!

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

2 participants