31 DEBUG ((DEBUG_MANAGEABILITY,
"%a: TCP connection is finished. Could be TSL session closure, reset HTTP instance for the new TLS session.\n", __func__));
33 Status = Instance->HttpIo.Http->Configure (Instance->HttpIo.Http,
NULL);
34 if (EFI_ERROR (Status)) {
35 DEBUG ((DEBUG_ERROR,
"%a: Error to reset HTTP instance.\n", __func__));
39 Status = Instance->HttpIo.Http->Configure (Instance->HttpIo.Http, &((
EFI_REST_EX_HTTP_CONFIG_DATA *)Instance->ConfigData)->HttpConfigData);
40 if (EFI_ERROR (Status)) {
41 DEBUG ((DEBUG_ERROR,
"%a: Error to re-initiate HTTP instance.\n", __func__));
69 if (!EFI_ERROR (HttpIoReceiveStatus)) {
72 if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY) == 0) {
73 DEBUG ((DEBUG_ERROR,
"%a: TCP error, reset HTTP session.\n", __func__));
74 Instance->Flags |= RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY;
77 if (!EFI_ERROR (Status)) {
81 DEBUG ((DEBUG_ERROR,
"%a: Reset HTTP instance fail.\n", __func__));
84 ReturnStatus = EFI_DEVICE_ERROR;
86 if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) {
87 DEBUG ((DEBUG_ERROR,
"%a: REST_EX Send and receive fail even with a new TLS session.\n", __func__));
88 ReturnStatus = EFI_DEVICE_ERROR;
91 Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY;
93 if (EFI_ERROR (Status)) {
94 DEBUG ((DEBUG_ERROR,
"%a: Reset HTTP instance fail.\n", __func__));
95 ReturnStatus = EFI_DEVICE_ERROR;
104 Instance->Flags &= ~(RESTEX_INSTANCE_FLAGS_TLS_RETRY | RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY);
139 if ((This ==
NULL) || (RequestMessage ==
NULL)) {
140 return EFI_INVALID_PARAMETER;
145 if ((RequestMessage->Data.Request->Method != HttpMethodPut) && (RequestMessage->Data.Request->Method != HttpMethodPost) &&
146 (RequestMessage->Data.Request->Method != HttpMethodPatch))
157 if (PreservedRequestHeaders !=
NULL) {
158 *PreservedRequestHeaders = RequestMessage->Headers;
162 CopyMem ((VOID *)NewHeaders, (VOID *)RequestMessage->Headers, RequestMessage->HeaderCount * sizeof (
EFI_HTTP_HEADER));
164 RequestMessage->HeaderCount++;
165 RequestMessage->Headers = NewHeaders;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define HTTP_EXPECT_100_CONTINUE
#define HTTP_HEADER_EXPECT
EFI_STATUS EFIAPI HttpSetFieldNameAndValue(IN OUT EFI_HTTP_HEADER *HttpHeader, IN CONST CHAR8 *FieldName, IN CONST CHAR8 *FieldValue)
#define DEBUG(Expression)
#define FixedPcdGetBool(TokenName)
EFI_STATUS RedfishCheckHttpReceiveStatus(IN RESTEX_INSTANCE *Instance, IN EFI_STATUS HttpIoReceiveStatus)
EFI_STATUS RedfishHttpAddExpectation(IN EFI_REST_EX_PROTOCOL *This, IN EFI_HTTP_MESSAGE *RequestMessage, IN EFI_HTTP_HEADER **PreservedRequestHeaders, IN BOOLEAN *ItsWrite)
EFI_STATUS ResetHttpTslSession(IN RESTEX_INSTANCE *Instance)
#define EFI_CONNECTION_FIN