aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Villin <avillin@cisco.com>2024-08-19 10:51:59 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-08-20 20:37:24 +0000
commit1fb7ae3440feeb6cb1843a4a410110d1e1ebd9fc (patch)
tree867a2d5e0cfc8c56d8bd80edb9c1b8efbf0de2be
parent86fa943725b5f7565133fd513da8d836f5f9c049 (diff)
vppinfra: fix format_clib_timebase_time
- make the format RFC9110 compliant Type: fix Change-Id: I4272562ca1082285a596ef866ab6c4f405c64bc5 Signed-off-by: Adrian Villin <avillin@cisco.com>
-rw-r--r--extras/hs-test/http_test.go2
-rw-r--r--src/vppinfra/time_range.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index f8b0fb79615..5e7494ace87 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -829,6 +829,7 @@ func HttpStaticBuildInUrlPostIfStatsTest(s *NoTopoSuite) {
}
func HttpStaticMacTimeTest(s *NoTopoSuite) {
+ currentDate := time.Now().In(time.FixedZone("GMT", 0)).Format(http.TimeFormat)
vpp := s.GetContainerByName("vpp").VppInstance
serverAddress := s.GetInterfaceByName(TapInterfaceName).Peer.Ip4AddressString()
s.Log(vpp.Vppctl("http static server uri tcp://" + serverAddress + "/80 url-handlers debug"))
@@ -848,6 +849,7 @@ func HttpStaticMacTimeTest(s *NoTopoSuite) {
s.AssertContains(string(data), s.GetInterfaceByName(TapInterfaceName).Ip4AddressString())
s.AssertContains(string(data), s.GetInterfaceByName(TapInterfaceName).HwAddress.String())
s.AssertContains(resp.Header.Get("Content-Type"), "json")
+ s.AssertContains(resp.Header.Get("Date"), currentDate)
}
func HttpInvalidRequestLineTest(s *NoTopoSuite) {
diff --git a/src/vppinfra/time_range.c b/src/vppinfra/time_range.c
index 4b5e1303763..54f5629641a 100644
--- a/src/vppinfra/time_range.c
+++ b/src/vppinfra/time_range.c
@@ -264,11 +264,10 @@ format_clib_timebase_time (u8 * s, va_list * args)
clib_timebase_time_to_components (now, cp);
- s = format (s, "%s, %u %s %u %u:%02u:%02u",
- day_names_epoch_order[cp->day_name_index],
- cp->day,
- month_short_names[cp->month],
- cp->year, cp->hour, cp->minute, cp->second);
+ s = format (s, "%s, %02u %s %u %02u:%02u:%02u",
+ day_names_epoch_order[cp->day_name_index], cp->day,
+ month_short_names[cp->month], cp->year, cp->hour, cp->minute,
+ cp->second);
return (s);
}