You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stefan Mayr <st...@mayr-stefan.de> on 2020/06/10 12:56:40 UTC

Wrong timezone in Date and Last-Modified-Headers

Hi,

today I've seen something I don't understand: our developers reported an
application that was returning a non-GMT timezone in Date and
Last-Modified headers.

$ curl -v http://localhost:8080
* Rebuilt URL to: http://localhost:8080/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200
< X-Correlation-Id: 68ef1063-dbbb-4216-a3a7-2acdb768abbd
< Last-Modified: Tue, 12 May 2020 14:04:15 YEKT
< Accept-Ranges: bytes
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< Strict-Transport-Security: max-age=31536000
< X-Frame-Options: DENY
< Content-Type: text/html;charset=UTF-8
< Content-Language: en-US
< Content-Length: 5409
< Date: Wed, 10 Jun 2020 20:42:26 JST
...

There you can see Date with JST and Last-Modified with YEKT instead of GMT

All other locales (LANG, LC_*, /etc/localtime) of this system are okay
and after a restart everything is correct again and I'm not able to
reproduce it

$ curl -vs http://localhost:8080 2>&1|egrep -i "Date|Last-Modified"
*  start date: Mar 25 10:50:00 2020 GMT
*  expire date: Mar 30 23:59:59 2021 GMT
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< date: Wed, 10 Jun 2020 11:52:42 GMT
< last-modified: Tue, 12 May 2020 09:04:15 GMT


This is a Spring Boot application with an embedded Tomcat (9.0.16)
running in a Cloud Foundry Container.

Reading through the source code of
org.apache.tomcat.util.http.FastHttpDateFormat I don't understand how
this is even possible.

Has anybody ever seen this or an idea what could have happened there?
After the restart I can't reproduce it.

Thanks,

   Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Wrong timezone in Date and Last-Modified-Headers

Posted by Stefan Mayr <st...@mayr-stefan.de>.
Hi,

Am 10.06.2020 um 15:34 schrieb Mark Thomas:
> On 10/06/2020 14:07, Paul Carter-Brown wrote:
>> At runtime, any code can call TimeZone.setDefault to change the timezone of
>> the JVM.
>>
>> I'd suggest logging  TimeZone.getDefault().getDisplayName(Locale.ENGLISH);
>> intermittently and seeing if some code somewhere is changing the timezone.
>> Could be in any library...
> 
> Most likely this:
> 
> https://bz.apache.org/bugzilla/show_bug.cgi?id=64226
> 
> Mark
> 
> 
>>
>> Paul

You were right. I missed that one in the release notes. Using a request
with a If-Modified-Since-Header changed the timezone in the Tomcat-Response.

Luckily the latest Spring Boot release 2.1.14 contains Tomcat 9.0.34
which includes the bugfix.

Thanks,

  Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Wrong timezone in Date and Last-Modified-Headers

Posted by Mark Thomas <ma...@apache.org>.
On 10/06/2020 14:07, Paul Carter-Brown wrote:
> At runtime, any code can call TimeZone.setDefault to change the timezone of
> the JVM.
> 
> I'd suggest logging  TimeZone.getDefault().getDisplayName(Locale.ENGLISH);
> intermittently and seeing if some code somewhere is changing the timezone.
> Could be in any library...

Most likely this:

https://bz.apache.org/bugzilla/show_bug.cgi?id=64226

Mark


> 
> Paul
> 
> 
> On Wed, Jun 10, 2020 at 2:56 PM Stefan Mayr <st...@mayr-stefan.de> wrote:
> 
>> Hi,
>>
>> today I've seen something I don't understand: our developers reported an
>> application that was returning a non-GMT timezone in Date and
>> Last-Modified headers.
>>
>> $ curl -v http://localhost:8080
>> * Rebuilt URL to: http://localhost:8080/
>> *   Trying 127.0.0.1...
>> * TCP_NODELAY set
>> * Connected to localhost (127.0.0.1) port 8080 (#0)
>>> GET / HTTP/1.1
>>> Host: localhost:8080
>>> User-Agent: curl/7.58.0
>>> Accept: */*
>>>
>> < HTTP/1.1 200
>> < X-Correlation-Id: 68ef1063-dbbb-4216-a3a7-2acdb768abbd
>> < Last-Modified: Tue, 12 May 2020 14:04:15 YEKT
>> < Accept-Ranges: bytes
>> < X-Content-Type-Options: nosniff
>> < X-XSS-Protection: 1; mode=block
>> < Cache-Control: no-cache, no-store, max-age=0, must-revalidate
>> < Pragma: no-cache
>> < Expires: 0
>> < Strict-Transport-Security: max-age=31536000
>> < X-Frame-Options: DENY
>> < Content-Type: text/html;charset=UTF-8
>> < Content-Language: en-US
>> < Content-Length: 5409
>> < Date: Wed, 10 Jun 2020 20:42:26 JST
>> ...
>>
>> There you can see Date with JST and Last-Modified with YEKT instead of GMT
>>
>> All other locales (LANG, LC_*, /etc/localtime) of this system are okay
>> and after a restart everything is correct again and I'm not able to
>> reproduce it
>>
>> $ curl -vs http://localhost:8080 2>&1|egrep -i "Date|Last-Modified"
>> *  start date: Mar 25 10:50:00 2020 GMT
>> *  expire date: Mar 30 23:59:59 2021 GMT
>> < cache-control: no-cache, no-store, max-age=0, must-revalidate
>> < date: Wed, 10 Jun 2020 11:52:42 GMT
>> < last-modified: Tue, 12 May 2020 09:04:15 GMT
>>
>>
>> This is a Spring Boot application with an embedded Tomcat (9.0.16)
>> running in a Cloud Foundry Container.
>>
>> Reading through the source code of
>> org.apache.tomcat.util.http.FastHttpDateFormat I don't understand how
>> this is even possible.
>>
>> Has anybody ever seen this or an idea what could have happened there?
>> After the restart I can't reproduce it.
>>
>> Thanks,
>>
>>    Stefan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Wrong timezone in Date and Last-Modified-Headers

Posted by Paul Carter-Brown <pa...@jini.guru>.
At runtime, any code can call TimeZone.setDefault to change the timezone of
the JVM.

I'd suggest logging  TimeZone.getDefault().getDisplayName(Locale.ENGLISH);
intermittently and seeing if some code somewhere is changing the timezone.
Could be in any library...

Paul


On Wed, Jun 10, 2020 at 2:56 PM Stefan Mayr <st...@mayr-stefan.de> wrote:

> Hi,
>
> today I've seen something I don't understand: our developers reported an
> application that was returning a non-GMT timezone in Date and
> Last-Modified headers.
>
> $ curl -v http://localhost:8080
> * Rebuilt URL to: http://localhost:8080/
> *   Trying 127.0.0.1...
> * TCP_NODELAY set
> * Connected to localhost (127.0.0.1) port 8080 (#0)
> > GET / HTTP/1.1
> > Host: localhost:8080
> > User-Agent: curl/7.58.0
> > Accept: */*
> >
> < HTTP/1.1 200
> < X-Correlation-Id: 68ef1063-dbbb-4216-a3a7-2acdb768abbd
> < Last-Modified: Tue, 12 May 2020 14:04:15 YEKT
> < Accept-Ranges: bytes
> < X-Content-Type-Options: nosniff
> < X-XSS-Protection: 1; mode=block
> < Cache-Control: no-cache, no-store, max-age=0, must-revalidate
> < Pragma: no-cache
> < Expires: 0
> < Strict-Transport-Security: max-age=31536000
> < X-Frame-Options: DENY
> < Content-Type: text/html;charset=UTF-8
> < Content-Language: en-US
> < Content-Length: 5409
> < Date: Wed, 10 Jun 2020 20:42:26 JST
> ...
>
> There you can see Date with JST and Last-Modified with YEKT instead of GMT
>
> All other locales (LANG, LC_*, /etc/localtime) of this system are okay
> and after a restart everything is correct again and I'm not able to
> reproduce it
>
> $ curl -vs http://localhost:8080 2>&1|egrep -i "Date|Last-Modified"
> *  start date: Mar 25 10:50:00 2020 GMT
> *  expire date: Mar 30 23:59:59 2021 GMT
> < cache-control: no-cache, no-store, max-age=0, must-revalidate
> < date: Wed, 10 Jun 2020 11:52:42 GMT
> < last-modified: Tue, 12 May 2020 09:04:15 GMT
>
>
> This is a Spring Boot application with an embedded Tomcat (9.0.16)
> running in a Cloud Foundry Container.
>
> Reading through the source code of
> org.apache.tomcat.util.http.FastHttpDateFormat I don't understand how
> this is even possible.
>
> Has anybody ever seen this or an idea what could have happened there?
> After the restart I can't reproduce it.
>
> Thanks,
>
>    Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>