Skip to content

Added config option to force http 1.0, fixes #131 #155

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
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/esp32FOTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ void esp32FOTA::setConfig( FOTAConfig_t cfg )
_cfg.pub_key = cfg.pub_key;
_cfg.signature_len = cfg.signature_len;
_cfg.allow_reuse = cfg.allow_reuse;
_cfg.use_http10 = cfg.use_http10;
}


void esp32FOTA::printConfig( FOTAConfig_t *cfg )
{
if( cfg == nullptr ) cfg = &_cfg;
log_d("Name: %s\nManifest URL:%s\nSemantic Version: %d.%d.%d\nCheck Sig: %s\nUnsafe: %s\nUse Device ID: %s\nRootCA: %s\nPubKey: %s\nSignatureLen: %d\n",
log_d("Name: %s\nManifest URL:%s\nSemantic Version: %d.%d.%d\nCheck Sig: %s\nUnsafe: %s\nUse Device ID: %s\nRootCA: %s\nPubKey: %s\nSignatureLen: %d\nHTTP Keep-Alive:%s\nHTTP 1.0:%s\n",
cfg->name ? cfg->name : "None",
cfg->manifest_url ? cfg->manifest_url : "None",
cfg->sem.ver()->major,
Expand All @@ -208,7 +209,8 @@ void esp32FOTA::printConfig( FOTAConfig_t *cfg )
cfg->root_ca ?"true":"false",
cfg->pub_key ?"true":"false",
cfg->signature_len,
cfg->allow_reuse
cfg->allow_reuse ? "true":"false",
cfg->use_http10 ? "true":"false"
);
}

Expand Down Expand Up @@ -367,7 +369,9 @@ bool esp32FOTA::setupHTTP( const char* url )
const char* rootcastr = nullptr;
_http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
_http.setReuse(_cfg.allow_reuse);
_http.useHTTP10(_cfg.use_http10);


log_i("Connecting to: %s", url );
if( String(url).startsWith("https") ) {
if (!_cfg.unsafe) {
Expand Down
1 change: 1 addition & 0 deletions src/esp32FOTA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ struct FOTAConfig_t
CryptoAsset* pub_key { nullptr };
size_t signature_len {FW_SIGNATURE_LENGTH};
bool allow_reuse { true };
bool use_http10 { false }; // Use HTTP 1.0 (WARNING: setting to 'true' disables chunked transfers)
FOTAConfig_t() = default;
};

Expand Down
Loading