Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5042,11 +5042,17 @@ HttpTransact::merge_response_header_with_cached_header(HTTPHdr *cached_header, H
//
if (field.m_next_dup) {
if (dups_seen == false) {
const char *name2;
int name_len2;

// use a second iterator to delete the
// remaining response headers in the cached response,
// so that they will be added in the next iterations.
for (auto spot2 = spot; spot2 != limit; ++spot2) {
cached_header->field_delete(&*spot2, true);
MIMEField &field2{*spot2};
name2 = field2.name_get(&name_len2);

cached_header->field_delete(name2, name_len2);
}
dups_seen = true;
}
Expand Down
29 changes: 28 additions & 1 deletion proxy/http/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if BUILD_TESTS
libhttp_a_SOURCES += RegressionHttpTransact.cc
endif

check_PROGRAMS = test_proxy_http test_PreWarm
check_PROGRAMS = test_proxy_http test_PreWarm test_HttpTransact

TESTS = $(check_PROGRAMS)

Expand Down Expand Up @@ -122,6 +122,33 @@ test_PreWarm_LDADD = \
test_PreWarm_SOURCES = \
unit_tests/test_PreWarm.cc

test_HttpTransact_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(abs_top_srcdir)/tests/include

if OS_LINUX
test_HttpTransact_LDFLAGS = $(AM_LDFLAGS)\
-Wl,--unresolved-symbols=ignore-all
else
test_HttpTransact_LDFLAGS = $(AM_LDFLAGS)\
-Wl,-undefined -Wl,suppress -Wl,-flat_namespace -Wl,-dead_strip
endif

test_HttpTransact_LDADD = \
$(top_builddir)/src/tscore/libtscore.la \
$(top_builddir)/src/records/librecords_p.a \
$(top_builddir)/proxy/ProxySession.o \
$(top_builddir)/proxy/http/HttpTransact.o \
$(top_builddir)/proxy/http/HttpTransactHeaders.o \
$(top_builddir)/proxy/hdrs/libhdrs.a \
$(top_builddir)/iocore/eventsystem/libinkevent.a \
@SWOC_LIBS@

test_HttpTransact_SOURCES = \
../../iocore/cache/test/stub.cc \
unit_tests/main.cc \
unit_tests/test_HttpTransact.cc

clang-tidy-local: $(libhttp_a_SOURCES) $(noinst_HEADERS)
$(CXX_Clang_Tidy)

Expand Down
60 changes: 60 additions & 0 deletions proxy/http/unit_tests/main.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/** @file

The main file for tests

@section license License

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

#include "tscore/I_Layout.h"

#include "I_EventSystem.h"
#include "records/I_RecordsConfig.h"

#include "diags.i"

#define TEST_THREADS 1

struct EventProcessorListener : Catch::TestEventListenerBase {
using TestEventListenerBase::TestEventListenerBase;

void
testRunStarting(Catch::TestRunInfo const & /* testRunInfo */) override
{
Layout::create();
init_diags("", nullptr);
RecProcessInit();
LibRecordsConfigInit();

ink_event_system_init(EVENT_SYSTEM_MODULE_PUBLIC_VERSION);
eventProcessor.start(TEST_THREADS);

EThread *main_thread = new EThread;
main_thread->set_specific();
}

void
testRunEnded(Catch::TestRunStats const & /* testRunStats */) override
{
}
};

CATCH_REGISTER_LISTENER(EventProcessorListener);
Loading