Sorry for the delay Jiaxin. I don't see issues with this. I did pull it into our build and didn't find any regression.
Reviewed-by : Samer El-Haj-Mahmoud <el...@hpe.com> -----Original Message----- From: Wu, Jiaxin [jiaxin...@intel.com] Received: Wednesday, 11 May 2016, 7:18PM To: El-Haj-Mahmoud, Samer [samer.el-haj-mahm...@hpe.com]; edk2-devel@lists.01.org [edk2-devel@lists.01.org] CC: Ye, Ting [ting...@intel.com]; Fu, Siyuan [siyuan...@intel.com]; Long, Qin [qin.l...@intel.com] Subject: RE: [edk2] [staging/HTTPS-TLS][PATCH] NetworkPkg: Handle HTTPS indefinite poll case Hi all, Any comments for this patch? Thanks. Jiaxin > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Jiaxin Wu > Sent: Wednesday, May 4, 2016 3:08 PM > To: edk2-devel@lists.01.org > Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Long, > Qin <qin.l...@intel.com> > Subject: [edk2] [staging/HTTPS-TLS][PATCH] NetworkPkg: Handle HTTPS > indefinite poll case > > This patch is used to handle handle HTTPS indefinite poll case. > > Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahm...@hpe.com> > Cc: Ye Ting <ting...@intel.com> > Cc: Fu Siyuan <siyuan...@intel.com> > Cc: Long Qin <qin.l...@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> > --- > NetworkPkg/HttpDxe/HttpImpl.c | 55 ++++++++++++++++++---------------- > NetworkPkg/HttpDxe/HttpProto.c | 68 > ++++++++++++++++++++++++++++++++++++++---- > 2 files changed, 93 insertions(+), 30 deletions(-) > > diff --git a/NetworkPkg/HttpDxe/HttpImpl.c > b/NetworkPkg/HttpDxe/HttpImpl.c index cf58b13..cd8fe05 100644 > --- a/NetworkPkg/HttpDxe/HttpImpl.c > +++ b/NetworkPkg/HttpDxe/HttpImpl.c > @@ -1179,47 +1179,50 @@ HttpResponseWorker ( > } > } > > ASSERT (HttpInstance->MsgParser != NULL); > > - // > - // We still need receive more data when there is no cache data and > MsgParser is not NULL; > - // > - if (!HttpInstance->UseHttps) { > - if (HttpInstance->TimeoutEvent == NULL) { > - // > - // Create TimeoutEvent for response > - // > - Status = gBS->CreateEvent ( > - EVT_TIMER, > - TPL_CALLBACK, > - NULL, > - NULL, > - &HttpInstance->TimeoutEvent > - ); > - if (EFI_ERROR (Status)) { > - goto Error; > - } > - } > - > + if (HttpInstance->TimeoutEvent == NULL) { > // > - // Start the timer, and wait Timeout seconds to receive the body packet. > + // Create TimeoutEvent for response > // > - Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, > HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND); > + Status = gBS->CreateEvent ( > + EVT_TIMER, > + TPL_CALLBACK, > + NULL, > + NULL, > + &HttpInstance->TimeoutEvent > + ); > if (EFI_ERROR (Status)) { > goto Error; > } > - > + } > + > + // > + // Start the timer, and wait Timeout seconds to receive the body packet. > + // > + Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, > + HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND); if (EFI_ERROR (Status)) > { > + goto Error; > + } > + > + // > + // We still need receive more data when there is no cache data and > + MsgParser is not NULL; // if (!HttpInstance->UseHttps) { > Status = HttpTcpReceiveBody (Wrap, HttpMsg, HttpInstance- > >TimeoutEvent); > > gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0); > > if (EFI_ERROR (Status)) { > goto Error; > } > } else { > - Status = HttpsReceive (HttpInstance, &Fragment, NULL); > + Status = HttpsReceive (HttpInstance, &Fragment, > + HttpInstance->TimeoutEvent); > + > + gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0); > + > if (EFI_ERROR (Status)) { > goto Error; > } > > // > @@ -1315,11 +1318,13 @@ Exit: > > Error2: > NetMapInsertHead (&HttpInstance->TxTokens, ValueInItem->HttpToken, > ValueInItem); > > Error: > - HttpTcpTokenCleanup (Wrap); > + if (!HttpInstance->UseHttps) { > + HttpTcpTokenCleanup (Wrap); > + } > > if (HttpHeaders != NULL) { > FreePool (HttpHeaders); > HttpHeaders = NULL; > } > diff --git a/NetworkPkg/HttpDxe/HttpProto.c > b/NetworkPkg/HttpDxe/HttpProto.c index 965a49f..ebb9dd9 100644 > --- a/NetworkPkg/HttpDxe/HttpProto.c > +++ b/NetworkPkg/HttpDxe/HttpProto.c > @@ -1230,11 +1230,40 @@ HttpConnectTcp4 ( > > // > // Tls session connection. > // > if (HttpInstance->UseHttps) { > - Status = TlsConnectSession (HttpInstance, NULL); > + if (HttpInstance->TimeoutEvent == NULL) { > + // > + // Create TimeoutEvent for TLS connection. > + // > + Status = gBS->CreateEvent ( > + EVT_TIMER, > + TPL_CALLBACK, > + NULL, > + NULL, > + &HttpInstance->TimeoutEvent > + ); > + if (EFI_ERROR (Status)) { > + TlsCloseTxRxEvent (HttpInstance); > + return Status; > + } > + } > + > + // > + // Start the timer, and wait Timeout seconds for connection. > + // > + Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, > HTTP_CONNECTION_TIMEOUT * TICKS_PER_SECOND); > + if (EFI_ERROR (Status)) { > + TlsCloseTxRxEvent (HttpInstance); > + return Status; > + } > + > + Status = TlsConnectSession (HttpInstance, > + HttpInstance->TimeoutEvent); > + > + gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0); > + > if (EFI_ERROR (Status)) { > TlsCloseTxRxEvent (HttpInstance); > return Status; > } > } > @@ -1293,11 +1322,40 @@ HttpConnectTcp6 ( > > // > // Tls session connection. > // > if (HttpInstance->UseHttps) { > - Status = TlsConnectSession (HttpInstance, NULL); > + if (HttpInstance->TimeoutEvent == NULL) { > + // > + // Create TimeoutEvent for TLS connection. > + // > + Status = gBS->CreateEvent ( > + EVT_TIMER, > + TPL_CALLBACK, > + NULL, > + NULL, > + &HttpInstance->TimeoutEvent > + ); > + if (EFI_ERROR (Status)) { > + TlsCloseTxRxEvent (HttpInstance); > + return Status; > + } > + } > + > + // > + // Start the timer, and wait Timeout seconds for connection. > + // > + Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, > HTTP_CONNECTION_TIMEOUT * TICKS_PER_SECOND); > + if (EFI_ERROR (Status)) { > + TlsCloseTxRxEvent (HttpInstance); > + return Status; > + } > + > + Status = TlsConnectSession (HttpInstance, > + HttpInstance->TimeoutEvent); > + > + gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0); > + > if (EFI_ERROR (Status)) { > TlsCloseTxRxEvent (HttpInstance); > return Status; > } > } > @@ -1758,11 +1816,11 @@ HttpTcpReceiveHeader ( > if (Fragment.Bulk != NULL) { > FreePool (Fragment.Bulk); > Fragment.Bulk = NULL; > } > > - Status = HttpsReceive (HttpInstance, &Fragment, NULL); > + Status = HttpsReceive (HttpInstance, &Fragment, Timeout); > if (EFI_ERROR (Status)) { > DEBUG ((EFI_D_ERROR, "Tcp4 receive failed: %r\n", Status)); > return Status; > } > } > @@ -1838,11 +1896,11 @@ HttpTcpReceiveHeader ( > } > > if (!HttpInstance->IsRxDone) { > gBS->CloseEvent (Rx6Token->CompletionToken.Event); > Rx6Token->CompletionToken.Status = EFI_TIMEOUT; > - } > + } > > Status = Rx6Token->CompletionToken.Status; > if (EFI_ERROR (Status)) { > return Status; > } > @@ -1853,11 +1911,11 @@ HttpTcpReceiveHeader ( > if (Fragment.Bulk != NULL) { > FreePool (Fragment.Bulk); > Fragment.Bulk = NULL; > } > > - Status = HttpsReceive (HttpInstance, &Fragment, NULL); > + Status = HttpsReceive (HttpInstance, &Fragment, Timeout); > if (EFI_ERROR (Status)) { > DEBUG ((EFI_D_ERROR, "Tcp6 receive failed: %r\n", Status)); > return Status; > } > } > -- > 1.9.5.msysgit.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel