Skip to content

Commit 6eeb20c

Browse files
author
Alex Hultman
committed
Don't inflate with zero length, turn off maxPayload
1 parent c9d856a commit 6eeb20c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int main()
2222
});
2323

2424
// our working server, does not listen
25-
Server worker(0, false, PERMESSAGE_DEFLATE | SERVER_NO_CONTEXT_TAKEOVER | CLIENT_NO_CONTEXT_TAKEOVER, 1000000);
25+
Server worker(0, false, PERMESSAGE_DEFLATE | SERVER_NO_CONTEXT_TAKEOVER | CLIENT_NO_CONTEXT_TAKEOVER/*, 1000000*/);
2626
::worker = &worker;
2727
::server = &server;
2828
worker.onConnection([](Socket socket) {

src/uWS.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ struct PerMessageDeflate {
223223
}
224224

225225
size_t inflate(char *dst, size_t dstLength) {
226+
if (!readStream.avail_in) {
227+
return dstLength;
228+
}
226229
readStream.next_out = (unsigned char *) dst;
227230
readStream.avail_out = dstLength;
228231
int err = ::inflate(&readStream, Z_NO_FLUSH);

0 commit comments

Comments
 (0)