summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NetworkPkg/HttpDxe/HttpImpl.c25
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.c38
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.h4
3 files changed, 44 insertions, 23 deletions
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 37064d15bc..ce28f07efa 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -318,7 +318,11 @@ EfiHttpRequest (
if (EFI_ERROR (Status)) {
RemotePort = HTTP_DEFAULT_PORT;
}
-
+ //
+ // If Configure is TRUE, it indicates the first time to call Request();
+ // If ReConfigure is TRUE, it indicates the request URL is not same
+ // with the previous call to Request();
+ //
Configure = TRUE;
ReConfigure = TRUE;
@@ -428,7 +432,11 @@ EfiHttpRequest (
//
// The request URL is different from previous calls to Request(), close existing TCP instance.
//
- ASSERT (HttpInstance->Tcp4 != NULL &&HttpInstance->Tcp6 != NULL);
+ if (!HttpInstance->LocalAddressIsIPv6) {
+ ASSERT (HttpInstance->Tcp4 != NULL);
+ } else {
+ ASSERT (HttpInstance->Tcp6 != NULL);
+ }
HttpCloseConnection (HttpInstance);
EfiHttpCancel (This, NULL);
}
@@ -446,13 +454,12 @@ EfiHttpRequest (
Wrap->HttpInstance = HttpInstance;
Wrap->TcpWrap.Method = Request->Method;
- if (Configure) {
- Status = HttpInitTcp (HttpInstance, Wrap);
- if (EFI_ERROR (Status)) {
- goto Error2;
- }
+ Status = HttpInitTcp (HttpInstance, Wrap, Configure);
+ if (EFI_ERROR (Status)) {
+ goto Error2;
+ }
- } else {
+ if (!Configure) {
//
// For the new HTTP token, create TX TCP token events.
//
@@ -461,7 +468,7 @@ EfiHttpRequest (
goto Error1;
}
}
-
+
//
// Create request message.
//
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index c4ffef2bc2..22aed253cb 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1181,7 +1181,7 @@ HttpConnectTcp4 (
EFI_TCP4_CONNECTION_STATE Tcp4State;
- if (HttpInstance->State != HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp4 == NULL) {
+ if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp4 == NULL) {
return EFI_NOT_READY;
}
@@ -1198,9 +1198,11 @@ HttpConnectTcp4 (
return Status;
}
- if (Tcp4State > Tcp4StateEstablished) {
+ if (Tcp4State == Tcp4StateEstablished) {
+ return EFI_SUCCESS;
+ } else if (Tcp4State > Tcp4StateEstablished ) {
HttpCloseConnection(HttpInstance);
- }
+ }
return HttpCreateConnection (HttpInstance);
}
@@ -1223,7 +1225,7 @@ HttpConnectTcp6 (
EFI_STATUS Status;
EFI_TCP6_CONNECTION_STATE Tcp6State;
- if (HttpInstance->State != HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp6 == NULL) {
+ if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp6 == NULL) {
return EFI_NOT_READY;
}
@@ -1241,8 +1243,10 @@ HttpConnectTcp6 (
return Status;
}
- if (Tcp6State > Tcp6StateEstablished) {
- HttpCloseConnection (HttpInstance);
+ if (Tcp6State == Tcp6StateEstablished) {
+ return EFI_SUCCESS;
+ } else if (Tcp6State > Tcp6StateEstablished ) {
+ HttpCloseConnection(HttpInstance);
}
return HttpCreateConnection (HttpInstance);
@@ -1253,6 +1257,7 @@ HttpConnectTcp6 (
@param[in] HttpInstance The HTTP instance private data.
@param[in] Wrap The HTTP token's wrap data.
+ @param[in] Configure The Flag indicates whether the first time to initialize Tcp.
@retval EFI_SUCCESS The initialization of TCP instance is done.
@retval Others Other error as indicated.
@@ -1261,7 +1266,8 @@ HttpConnectTcp6 (
EFI_STATUS
HttpInitTcp (
IN HTTP_PROTOCOL *HttpInstance,
- IN HTTP_TOKEN_WRAP *Wrap
+ IN HTTP_TOKEN_WRAP *Wrap,
+ IN BOOLEAN Configure
)
{
EFI_STATUS Status;
@@ -1271,10 +1277,13 @@ HttpInitTcp (
//
// Configure TCP instance.
//
- Status = HttpConfigureTcp4 (HttpInstance, Wrap);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Configure) {
+ Status = HttpConfigureTcp4 (HttpInstance, Wrap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
//
// Connect TCP.
//
@@ -1286,10 +1295,13 @@ HttpInitTcp (
//
// Configure TCP instance.
//
- Status = HttpConfigureTcp6 (HttpInstance, Wrap);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Configure) {
+ Status = HttpConfigureTcp6 (HttpInstance, Wrap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
//
// Connect TCP.
//
diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h
index a15e0a87be..e43a2dc01c 100644
--- a/NetworkPkg/HttpDxe/HttpProto.h
+++ b/NetworkPkg/HttpDxe/HttpProto.h
@@ -456,6 +456,7 @@ HttpTcpNotReady (
@param[in] HttpInstance The HTTP instance private data.
@param[in] Wrap The HTTP token's wrap data.
+ @param[in] Configure The Flag indicates whether the first time to initialize Tcp.
@retval EFI_SUCCESS The initialization of TCP instance is done.
@retval Others Other error as indicated.
@@ -464,7 +465,8 @@ HttpTcpNotReady (
EFI_STATUS
HttpInitTcp (
IN HTTP_PROTOCOL *HttpInstance,
- IN HTTP_TOKEN_WRAP *Wrap
+ IN HTTP_TOKEN_WRAP *Wrap,
+ IN BOOLEAN Configure
);
/**