Skip to content

Commit

Permalink
Added config option to force http 1.0, fixes #131
Browse files Browse the repository at this point in the history
  • Loading branch information
tobozo committed Aug 19, 2024
1 parent 6174752 commit a0cd3da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit a0cd3da

Please sign in to comment.