Skip to content
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

NetworkPkg/HttpBootDxe: Resume an interrupted boot file download. #6066

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

leandrobecker-pst
Copy link
Contributor

When the boot file download operation is interrupted for some reason, HttpBootDxe will use HTTP Range header to try resume the download operation reusing the bytes downloaded so far.

Description

Sometimes while downloading a large boot file, like a Windows PE ISO file, the TCP connection drops and the HTTP operation is terminated with timeout. As HTTP have support to resume interrupted downloads using HTTP Range header, the download operation will be retried to get the remaining file data, keeping data that was already downloaded before the connection drop.

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

Configure the UEFI HTTP Boot feature to download a large .ISO file, like Windows .ISO file. During the file download, remove the uplink cable from your network switch and wait for the number of seconds defined at PCD PcdHttpIoTimeout. Reconnect the uplink cable to your network switch, the download operation must continue from the point were it was stopped.

Integration Instructions

N/A

NetworkPkg/HttpBootDxe/HttpBootClient.c Show resolved Hide resolved
NetworkPkg/HttpBootDxe/HttpBootClient.c Outdated Show resolved Hide resolved
NetworkPkg/HttpBootDxe/HttpBootImpl.c Outdated Show resolved Hide resolved
@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar,

Do I need to close this pull request and start another one? I'm new with this.

Thank you!

@SaloniKasbekar
Copy link
Contributor

SaloniKasbekar commented Aug 9, 2024

Hi @SaloniKasbekar,

Do I need to close this pull request and start another one? I'm new with this.

Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Didn't worked. I ammended my commit and when tryied to push to my branch, is has failed. Probably because the previous push I did is now missing from my local copy after the ammend. What do you suggest? Restart from zero? No problem to me. I'm not an git expert.

@SaloniKasbekar
Copy link
Contributor

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Didn't worked. I ammended my commit and when tryied to push to my branch, is has failed. Probably because the previous push I did is now missing from my local copy after the ammend. What do you suggest? Restart from zero? No problem to me. I'm not an git expert.

Can you share the command you used, and the error? Most likely you'll need to add a --force when pushing to your fork when trying to amend the previous commit.

@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Hi @SaloniKasbekar,
Do I need to close this pull request and start another one? I'm new with this.
Thank you!

You can amend your commit and push the changes onto your branch. That will directly update this PR. You dont need to close this and start a new PR.

Didn't worked. I ammended my commit and when tryied to push to my branch, is has failed. Probably because the previous push I did is now missing from my local copy after the ammend. What do you suggest? Restart from zero? No problem to me. I'm not an git expert.

Can you share the command you used, and the error? Most likely you'll need to add a --force when pushing to your fork when trying to amend the previous commit.

Using --force did the trick. Thanks

NetworkPkg/HttpBootDxe/HttpBootClient.c Outdated Show resolved Hide resolved
NetworkPkg/HttpBootDxe/HttpBootImpl.c Outdated Show resolved Hide resolved
@leandrobecker-pst leandrobecker-pst force-pushed the HttpBootWithResume branch 2 times, most recently from 6051ef7 to 35a1652 Compare August 14, 2024 11:08
@leandrobecker-pst
Copy link
Contributor Author

As a complement, below is a log from a computer BIOS I'm working with, showing this improvement in action:

...
TcpInput: sequence acceptance test failed for segment of TCB 3F27AA98
TcpInput: Discard a packet
TcpInput: sequence acceptance test failed for segment of TCB 3F27AA98
TcpInput: Discard a packet
HttpBootGetBootFile: Transfer error. Bytes transferred so far: 6502830.
TcpOnAppAbort: connection reset issued by application for TCB 3F27AA98
HttpBootLoadFile: Download interrupted, will try to resume the operation.
HttpBootGetBootFile: Resuming failed download. Range: bytes=6502830-519127039
HttpBootGetBootFile: If-Match="3413b8488fe0628f20fa77171559f482-62"
TlsDecryptPacket: No data read from TLS object.
TcpInput: sequence acceptance test failed for segment of TCB 3F27AA98
TcpInput: Discard a packet
TcpInput: sequence acceptance test failed for segment of TCB 3F27AA98
TcpInput: Discard a packet
DiskIoDxe.Start(42B69618)[PciRoot(0x0)/Pci(0x1F,0x6)/MAC(8080DEADBEEF,0x0)/IPv4(0.0.0.0)/Dns(192.168.3.1)/Uri(https://NOT_SHOW/WinPe.iso)/VirtualCD(0x157B0000,0x346C3FFF,0)]=Success
...

@leandrobecker-pst
Copy link
Contributor Author

I believe that all the required fixes were applied. If you need something else, please let me know.

Copy link

mergify bot commented Aug 27, 2024

PR can not be merged due to conflict. Please rebase and resubmit

@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar.

During the rebase in my local computer, I solved a conflict in source you have changed. When I pushed it again, a conflict happened and a merge was made by GitHub. I undestand that merges are not allowed, so what do you suggest? Delete my branch from GitHub and push it again?

@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar.

During the rebase in my local computer, I solved a conflict in source you have changed. When I pushed it again, a conflict happened and a merge was made by GitHub. I undestand that merges are not allowed, so what do you suggest? Delete my branch from GitHub and push it again?

I'm working with git rebase -i to solve this, please wait...

Copy link

mergify bot commented Aug 27, 2024

PR can not be merged due to conflict. Please rebase and resubmit

@leandrobecker-pst
Copy link
Contributor Author

leandrobecker-pst commented Aug 27, 2024

Hi @SaloniKasbekar.
During the rebase in my local computer, I solved a conflict in source you have changed. When I pushed it again, a conflict happened and a merge was made by GitHub. I undestand that merges are not allowed, so what do you suggest? Delete my branch from GitHub and push it again?

I'm working with git rebase -i to solve this, please wait...

@SaloniKasbekar I'll give up. I will open another pull request later and close this one. It keeps conflicting even after I have rebased everything. Maybe I'm too newby using git.

@leandrobecker-pst
Copy link
Contributor Author

Hi @SaloniKasbekar.
During the rebase in my local computer, I solved a conflict in source you have changed. When I pushed it again, a conflict happened and a merge was made by GitHub. I undestand that merges are not allowed, so what do you suggest? Delete my branch from GitHub and push it again?

I'm working with git rebase -i to solve this, please wait...

@SaloniKasbekar I'll give up. I will open another pull request later and close this one. It keeps conflicting even after I have rebased everything. Maybe I'm too newby using git.

I think is finally ok. I restarted by branch using the last EDK2 master.

@leandrobecker-pst leandrobecker-pst force-pushed the HttpBootWithResume branch 2 times, most recently from 3086c4f to ca15484 Compare September 4, 2024 20:08
Added HTTP header definitions for the following headers:
"Content-Range", "Last-Modified" and "If-Unmodified-Since"

Signed-off-by: Leandro Gustavo Biss Becker <[email protected]>
When the boot file download operation is interrupted for some reason,
HttpBootDxe will use HTTP Range header to try resume the download
operation reusing the bytes downloaded so far.

Signed-off-by: Leandro Gustavo Biss Becker <[email protected]>
@lgao4 lgao4 added the push Auto push patch series in PR if all checks pass label Sep 13, 2024
@mergify mergify bot merged commit 69139e3 into tianocore:master Sep 13, 2024
126 checks passed
@leandrobecker-pst leandrobecker-pst deleted the HttpBootWithResume branch September 13, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants