Skip to content

Commit ac6601a

Browse files
authored
Merge pull request #155 from chrisjoyce911/0.2.9
Added config option to force http 1.0, fixes #131
2 parents 6174752 + a0cd3da commit ac6601a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/esp32FOTA.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,14 @@ void esp32FOTA::setConfig( FOTAConfig_t cfg )
190190
_cfg.pub_key = cfg.pub_key;
191191
_cfg.signature_len = cfg.signature_len;
192192
_cfg.allow_reuse = cfg.allow_reuse;
193+
_cfg.use_http10 = cfg.use_http10;
193194
}
194195

195196

196197
void esp32FOTA::printConfig( FOTAConfig_t *cfg )
197198
{
198199
if( cfg == nullptr ) cfg = &_cfg;
199-
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",
200+
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",
200201
cfg->name ? cfg->name : "None",
201202
cfg->manifest_url ? cfg->manifest_url : "None",
202203
cfg->sem.ver()->major,
@@ -208,7 +209,8 @@ void esp32FOTA::printConfig( FOTAConfig_t *cfg )
208209
cfg->root_ca ?"true":"false",
209210
cfg->pub_key ?"true":"false",
210211
cfg->signature_len,
211-
cfg->allow_reuse
212+
cfg->allow_reuse ? "true":"false",
213+
cfg->use_http10 ? "true":"false"
212214
);
213215
}
214216

@@ -367,7 +369,9 @@ bool esp32FOTA::setupHTTP( const char* url )
367369
const char* rootcastr = nullptr;
368370
_http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
369371
_http.setReuse(_cfg.allow_reuse);
372+
_http.useHTTP10(_cfg.use_http10);
370373

374+
371375
log_i("Connecting to: %s", url );
372376
if( String(url).startsWith("https") ) {
373377
if (!_cfg.unsafe) {

src/esp32FOTA.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ struct FOTAConfig_t
221221
CryptoAsset* pub_key { nullptr };
222222
size_t signature_len {FW_SIGNATURE_LENGTH};
223223
bool allow_reuse { true };
224+
bool use_http10 { false }; // Use HTTP 1.0 (WARNING: setting to 'true' disables chunked transfers)
224225
FOTAConfig_t() = default;
225226
};
226227

0 commit comments

Comments
 (0)