Skip to content

Commit

Permalink
The remote HTTP server is returning SSL packets that are 9K which is …
Browse files Browse the repository at this point in the history
…bigger than our default 4K. (#2173)

This change increases the SSL max buffer size to 16K and recommends the use of BearSSL as it handles
better bigger SSL packets.
  • Loading branch information
slaff committed Dec 8, 2020
1 parent 0826d2c commit 8754311
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions samples/HttpClient/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ int onDownload(HttpConnection& connection, bool success)

void sslRequestInit(Ssl::Session& session, HttpRequest& request)
{
// Go with maximum buffer sizes
session.maxBufferSize = Ssl::MaxBufferSize::K16;

/**
* If there is not enough RAM and the response from the server is not a big one
* you may prefer to set the size to a lower value. One useful value would be 4K
*
* session.maxBufferSize = Ssl::MaxBufferSize::K4;
*
* Unfortunately most of the servers may ignore this plea from
* our HTTP client and send big SSL packet.
*/

/*
* SSL validation: We check the remote server certificate against a fingerprint
* Note that fingerprints _may_ change, in which case these need to be updated.
Expand Down
3 changes: 2 additions & 1 deletion samples/HttpClient/component.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## size of the flash chip
SPI_SIZE ?= 4M

ENABLE_SSL = 1
## Prefer BearSSL as it can handle more gracefully big SSL packets.
ENABLE_SSL ?= Bearssl

0 comments on commit 8754311

Please sign in to comment.