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

Nextcloud richdocument cannot get preview of large PDF or Office docs from CODE server due to Expect: 100-Continue #6983

Open
erikfdev opened this issue Jul 28, 2023 · 4 comments
Labels
bug Something isn't working unconfirmed

Comments

@erikfdev
Copy link

I am running Nextcloud 27.0.1 and CollaboraOnline CODE 23.05.2.2 (installed from your deb-packages repository) on the same server.
My server OS is Linux Mint 20.1.

Nextcloud uses app 'richdocuments' to produce preview of PDF and Office docs. App Richdocuments uses Guzzle to send (via apache reverse proxy) the request:
POST /cool/convert-to/png HTTP/1.1 / Host: the.name.of.my.host.net / Expect: 100-Continue / Content-Type: multipart/form-data; boundary=aae3d303568bfddc5e50234056e4475d5bc1ab77 / User-Agent: Nextcloud Server Crawler / Accept-Encoding: gzip / X-Forwarded-For: 192.168.0.1 / X-Forwarded-Host: office.invara-erde.freeddns.org / X-Forwarded-Server: the.name.of.my.host.net / Content-Length: 2572543 / Connection: Keep-Alive

Note the 'Expect: 100-Continue'. This is present when the document to be converted is large.
Apparently conforming the HTTP standard, Guzzle waits for a '100 Continue' reply from the CODE server before sending the contents of the document to be converted.
However, the CODE server does not always send a '100 Continue' reply. This causes the apache process running Guzzle to hang, and no preview is sent to the browser.
Furthermore, this issue also causes large nextcloud PDF files not to be displayed properly in the browser.

In my humble opinion, the problem might be located in method StreamSocket::parseHeader() around line 1160.
My understanding of the code is that only the first time a 'Expect: 100-Continue' is encountered, CODE will send '100 Continue'. However, I wonder why not every 'Expect: 100-Continue' gets its '100 Continue' reply. My understanding of the HTTP standard is that this should be sent each time, unless the request is already complete (which isn't the case here because the document contents is still to follow).

@erikfdev
Copy link
Author

Anybody looking into this?

@joshtrichards
Copy link

Just adding context:

online/net/Socket.cpp

Lines 1165 to 1174 in c310303

const std::string expect = request.get("Expect", "");
const bool getExpectContinue = Util::iequal(expect, "100-continue");
if (getExpectContinue && !_sentHTTPContinue)
{
LOG_TRC("Got Expect: 100-continue, sending Continue");
// FIXME: should validate authentication headers early too.
send("HTTP/1.1 100 Continue\r\n\r\n",
sizeof("HTTP/1.1 100 Continue\r\n\r\n") - 1);
_sentHTTPContinue = true;
}

Support was originally added for 100-Continue in:

4f804a4

https://gerrit.libreoffice.org/c/online/+/72746/1

@erikfdev
Copy link
Author

Apparently the problem does not appear anymore with Collabora Office 23.05.5.4 combined with Nextcloud 27.1.3.
I don't know how that got fixed.

@tcitworld
Copy link
Contributor

Probably with nextcloud/richdocuments#3298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
Status: No status
Development

No branches or pull requests

3 participants