Re: Tomcat with half open tcp sockets

2018-10-03 Thread Alex O'Ree
Thanks Chris.  I ended up using aggressive read timeout values on the Web
service clients by adding properties to the binding provider. Thing is,
every jre version and soap attacks use different versions which made this
much harder to track down.


On Tue, Oct 2, 2018, 1:44 PM Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Alex,
>
> On 9/29/18 08:31, Alex O'Ree wrote:
> > Does tomcat detect or mitigate against half open tcp connections?
>
> Not directly. Basically, that's the OS's job.
>
> > I recently ran into an issue where something in between a java
> > jaxws client and a jaxws service running in tomcat is interfering
> > with the tcp stream. Resolving this client side has been a
> > challenge due the transmitting thread hanging forever waiting to
> > read from the remote server and not being able to be interrupted or
> > aborted. While troubleshooting this, it dawned on me that services
> > running in tomcat may run into a similar problem and was wondering
> > if tomcat has any safe guards for this scenario. If it does, what
> > is the strategy used? I'm thinking maybe I can something similar
> > client side.
>
> In these cases, the only option the server has is to close the
> connection and then let the TCP stack purge the connection after some
> time in the penalty box (FIN_WAIT, FIN_WAIT2, or TIME_WAIT).
>
> If you see these kinds of connections piling-up, you may want to tweak
> the options of your TCP stack to have them cleared-out more quickly.
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAluzrmsACgkQHPApP6U8
> pFh2rg//cX7UAqis6qKHTDpgOSSBjFIusm7kdxW58/VpWcp/JzUfNhFLLl0aeCsT
> NbU38l0W0UqYXTCu0sMuPCKGLGYpwuAOCuWq6mJq4VFWtUCyBmCP/A2pvtTzW8js
> f4e0npXpp/3TxdDx9xNpLfWDv6nzqyzEXhIvfWvjtxNmcA1kGq2ueeHgVCWwb6v0
> CJ1VbF52R3B8Gq61u86uV8PPTsUKVIDnn+e+snkLlGMl+lcdBUcGBsxguOaoDHca
> lRN4gkpXjk946Nor7wPkMG4hUBndD7L/nhWNqrqZnd8TKJJxD+98U419LRFq0xSG
> qyAx75oNUUwo2l14q/xGTdAGwOzijfOyvnVscljV9fWGEtOMjOFoqPFlHK6QCec7
> ysZGuSoEJPuBYfFzdnQE4aOiRNYnAkYAmv6CEq/o0DEgZpuxm/ZAaMzrfP6XH8wk
> 072o62Cq0gN50q2KYSi7XJD61Akh4nJUl/7XSYKFU8Tj+jHYQBdw22EXEsgrhPuW
> gyTdH4TxHv40NmMOv9YQXOA0oyiXq/PXGA85gIhQyJdFoa4U8LXC++UBJCk3gNW8
> pOO2pFSJ8WAfOrK45Fcl/NgK4066BSqaQu6txnb/Bo/7VCPrPZvZ2/VgLaO/L6jD
> nb8sXBkozGtrS2sigKHx7HzJNb0r5EE1Uqbpk3YFYcntrl4afHs=
> =yRjT
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


StuckThreadDetectionValve with threads on IO

2018-10-03 Thread Behrooz Nobakht
[1] uses a time based threshold to mark a request thread as "stuck" above
the configured threshold.

This is definitely useful, but maybe a thread is busy transferring a large
request (IO). This could become
a wrong conclusion for the thread to be marked as stuck.

A relevant contextual example is that nginx has proxy_read_timeout [2]
(although Tomcat is not by definition a proxy)
The above checks if the server is transmitting any bytes over the wire
(socket read timeout) to decide if a request is stuck or not.

I am wondering if there's a similar way to achieve the same in Tomcat
(possibly without using NIO connectors)?

Thanks,
Behrooz


[1]:
https://github.com/apache/tomcat/blob/TOMCAT_9_0_12/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
[2]:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout


Use existing CGI response for HTTP errors

2018-10-03 Thread Daniel Becroft
Hi,

We are setting up Tomcat 8 to use a CGI program (.exe, proprietary) to
generate and return various JSON responses. This all works fine when the
response is a HTTP 200. But, when an HTTP error is returned (HTTP 4xx),
Tomcat is generating the HTML page instead.

We have the same setup working under IIS, and we had to configure the
following option there to stop IIS doing the same thing:



Is there an existing option somewhere in Tomcat that will do the same thing
(ie keep the CGI response intact even if it's a HTTP error)? I can't seem
to find one.
---
Daniel Becroft


Re: Load Balancing to Tomcat Workers

2018-10-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Loai,

On 10/3/18 16:07, Loai Abdallatif wrote:
> Hello,
> 
> I have configures web server with jk load balancer to tomcat
> server (192.168.237.11) with two containers  worker 0, worker1) the
> problem is that the web application session seems keep rotating
> between both workers but I need session stickeness, means the
> client will be connected to the same worker which doesn't occur ,

Sticky sessions are the default.

> the workers.properties file has this content : 
> worker.list=EVOUCHER_LB, jk-status, jk-manager, EVOUCHER_LB #
> Define worker0 -- appserver1 worker.worker_app1.type=ajp13 
> worker.worker_app1.host=192.168.237.11 
> worker.worker_app1.port=8009 
> worker.worker_app1.socket_timeout=1200 
> worker.worker_app1.connection_pool_size=1 
> worker.worker_app1.connection_pool_timeout=1300 
> worker.worker_app1.lbfactor=1 
> worker.worker_app1.redirect=worker_app2 
> worker.worker_app1.sticky_session=1

You haven't specified a route name. Is the jvmRoute for your
192.168.237.11 set to "worker_app1"? If not, you'll have to set
worker.worker_app1.route=routeName and do the same in your 
for your jvmRoute attribute.

> # 
> #Define worker1 -- appserver1 worker.worker_app2.type=ajp13 
> worker.worker_app2.host=192.168.237.11 
> worker.worker_app2.port=8109 
> worker.worker_app2.socket_timeout=1200 
> worker.worker_app2.connection_pool_size=1 
> worker.worker_app2.connection_pool_timeout=1300 
> worker.worker_app2.lbfactor=1 
> worker.worker_app2.redirect=worker_app1 
> worker.worker_app2.sticky_session=1

Same here.

Read the workers.properties documentation[1] for these settings just
to make sure you understand everything before you start changing
things. Specifically, read the introduction to the "Load Balancing
Directives" section (which specifically, in RED TEXT, warns you about
setting these parameters and making sure they agree). Read about the
"route" attribute and also read about "redirect" (which shouldn't be
necessary unless there is a specific reason to fail-over to one worker
specifically, as opposed to one in particular). The only use-case I
can think of for "redirect" is when you are using the BackupManager
for session-clustering.

Hope that helps,
- -chris

[1] http://tomcat.apache.org/connectors-doc/reference/workers.html
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlu1KTkACgkQHPApP6U8
pFipzhAAt4Z6gqyIjLn+gDMVXeQU9FxXhkRSdRnDN7M1ZDbz0hMoNkTzkWz++w/L
F2Y47n8RbLydwM7KGKFoKK8uWud4APAXtSPamlRuleAp9fajTbNSAtfs0zTQLGZc
teDwmBuxYWgtpnmhzPEWfZ03MLzbkprt5Z3nREu0Zbt34Z0VFCJ5v1Q/i3fJjP9M
2XyU/KbSrLAqn6bZwhpqVVS6kbQq0wCabbz5yoDfh8T2t1pehnfMCq3RrXr9q8Kb
8uS5aKnXyQkLPse9OFGNDGMFkL3Q3dSc0jWZXzQnerX/EgDrQqHfURqHcXS795WP
5uF0k04boIx91SJLov/H4dDzWj5eT70PL/9dxQaJcradVYquFxI/FgXnuDtvvyFF
MOT52NyFs95LpAUZ4WoQEWAGfsg8Zk/Btz6e97RYQ2fCm2c7xHnNRWK/63T9fEHl
YwBlp3G4XHWI2PoalA+CVrm3/xJd7noDSBHjpq2CN+0npBDJFvT01cupzJybPKVF
k9tqK/KB1BOqn2LL7V7e+1xKcADF5XB5/Kbq66qAAgkYducMnrZUVcphfWhdnXG0
r4+Mnt2enpcmdpLGL8/+AK/iYiOz79PDe7xPKJdMNpD7jAyZQD+7bghcPbXOujdW
K6OOvLHLDQ6P1Om+fT7WGQZnd5dDDpJaQqquEsYNAUA2bFQdwvg=
=+5Fi
-END PGP SIGNATURE-

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



Load Balancing to Tomcat Workers

2018-10-03 Thread Loai Abdallatif
Hello,

I have configures web server with jk load balancer to tomcat server
(192.168.237.11) with two containers  worker 0, worker1)
the problem is that the web application session seems keep rotating between
both workers but I need session stickeness, means the client will be
connected to the same worker which doesn't occur ,

the workers.properties file has this content :
worker.list=EVOUCHER_LB, jk-status, jk-manager, EVOUCHER_LB
# Define worker0 -- appserver1
worker.worker_app1.type=ajp13
worker.worker_app1.host=192.168.237.11
worker.worker_app1.port=8009
worker.worker_app1.socket_timeout=1200
worker.worker_app1.connection_pool_size=1
worker.worker_app1.connection_pool_timeout=1300
worker.worker_app1.lbfactor=1
worker.worker_app1.redirect=worker_app2
worker.worker_app1.sticky_session=1
#
#Define worker1 -- appserver1
worker.worker_app2.type=ajp13
worker.worker_app2.host=192.168.237.11
worker.worker_app2.port=8109
worker.worker_app2.socket_timeout=1200
worker.worker_app2.connection_pool_size=1
worker.worker_app2.connection_pool_timeout=1300
worker.worker_app2.lbfactor=1
worker.worker_app2.redirect=worker_app1
worker.worker_app2.sticky_session=1


[SECURITY] CVE-2018-11784 Apache Tomcat - Open Redirect

2018-10-03 Thread Mark Thomas
CVE-2018-11784 Apache Tomcat - Open Redirect

Severity: Moderate

Vendor: The Apache Software Foundation

Versions Affected:
Apache Tomcat 9.0.0.M1 to 9.0.11
Apache Tomcat 8.5.0 to 8.5.33
Apache Tomcat 7.0.23 to 7.0.90
The unsupported 8.0.x release line has not been analysed but is likely
to be affected.

Description:
When the default servlet returned a redirect to a directory (e.g.
redirecting to '/foo/' when the user requested '/foo') a specially
crafted URL could be used to cause the redirect to be generated to any
URI of the attackers choice.

Mitigation:
Users of the affected versions should apply one of the following
mitigations:
- Upgrade to Apache Tomcat 9.0.12 or later.
- Upgrade to Apache Tomcat 8.5.34 or later.
- Upgrade to Apache Tomcat 7.0.91 or later.
- Use mapperDirectoryRedirectEnabled="true" and
  mapperContextRootRedirectEnabled="true" on the Context to ensure that
  redirects are issued by the Mapper rather than the default Servlet.
  See the Context configuration documentation for further important
  details.

Credit:
This vulnerability was found by Sergey Bobrov and reported responsibly
to the Apache Tomcat Security Team.

History:
2018-10-03 Original advisory

References:
[1] http://tomcat.apache.org/security-9.html
[2] http://tomcat.apache.org/security-8.html
[3] http://tomcat.apache.org/security-7.html

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



Re: [EXTERNAL] Re: Tomcat custom location for configuration

2018-10-03 Thread Amit Pande
Thank you so much, Mark!

In our case, the server.xml contains some information which is generated run 
time (pre-config before Tomcat is started) like the paths to key store and 
trust store, cipher suites, etc.

Also, we have an active-passive cluster setup in which only the currently 
active node has the access to a shared disk which has all our product 
configuration data including the key store,  trust store files needed in 
server.xml.

We have a requirement to share the configuration across both the nodes of the 
cluster to avoid keeping duplicate copies of configuration (server.xml). And 
since some of the server.xml configuration is generated runtime, it isn’t 
trivial in our case to keep these copies in sync.

This is the prime reason to have a shared Tomcat configuration. We may also 
want, in future, to spawn and additional instance of Tomcat with re-usable 
configuration (except adjusting the port numbers ).

The not-so-elegant choice we might have is to move the entire Tomcat 
installation to this cluster aware shared storage but defeats the purpose of 
having a shared disk for configuration data and not the binaries.

What alternates should we explore?

Thanks,
Amit

On 10/3/18, 10:16 AM, "Mark Thomas"  wrote:

On 02/10/18 17:41, Amit Pande wrote:
> Hello SMEs,
> 
> I am looking at Tomcat documentation to see if there is a way to move the 
“/conf” to a custom location and use this path while 
running the startup/shutdown scripts.

Why? What problem are you trying to solve?

> I have looked at the 
https://github.com/apache/tomcat85/blob/TOMCAT_8_5_34/java/org/apache/catalina/startup/Catalina.java
 and confirmed we can pass a -config  to the Tomcat 
scripts (catalina.bat/sh, startup.bat/sh, etc).
> 
> Wanted to confirm:
> 
> 
>   1.  Why is “-config” option not documented as part of help of the 
startup/shutdown scripts? Is this a supported configuration that we can use 
without worrying about future breaking changes in this?

It appears that this dates back to Tomcat 4.0.x (I couldn't find it in
3.3.x). It isn't something that I have seen used very much.

If I had to guess, I'd say the option was added either when server.xml
was the only configuration file or the location of the other
configuration files could be specified in server.xml.

Over the years additional configuration files were added to the default
location and, because the -config option was little used, the
requirement to make that location configurable wasn't considered.

>   2.  Currently, as part of “-config” option we’re able to pass on the 
path to server.xml only. What is required to be done so that entire Tomcat 
configuration (conf directory) can be moved to a custom location?

Looks like a fair amount of work as $CATALINA_BASE/conf/ is hard-coded
in a *lot* of places. Making it configurable is going to be very
invasive. There would need to be a very strong justification for a
change along those lines.

>   3.  I am still debugging why, but on Linux setups, I have observed 
“configtest” script isn’t working with “-config ”. I am 
seeing “WARNING: Unable to load server configuration from 
[path_to_server_dot_xml] Configuration error detected!”. Is this know issue on 
Linux system? It seemed to work fine for Windows.

I suspect it is a bug.

> Appreciate your inputs.

At this point my recommendation would be to look at alternative
solutions rather than using -config. Once we know what the requirement
is, we can provide some advice.

Mark

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





Re: Apache failed to initialize connector

2018-10-03 Thread Gael REYNOARD
Thank you for that answer
The Windows firewall is disabled on my machine, but I will try this method
and I will come back to you if it corrects my problem.

Best regards,
--
*  Gaël REYNOARD* - Ingénieur Recherche & Développement
  Service *Bureau d'étude informatique*
  44 avenue Victor Meunier - 33530 BASSENS
  Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
  gael.reyno...@lafon.fr - www.lafon.fr


Le mer. 3 oct. 2018 à 17:06, M. Manna  a écrit :

> it looks like you've bound your port 8009 and 8080 with something else
> temporarily during windows startup.It may be some port scanning service or
> some firewall/ prevention service is blocking all the ports until some
> checks are done. And that is why you have this issue intermittently.
>
> As a verification, you can disable auto startup of tomcat service upon
> window start. Upon startup, you can start tomcat manually (repeat it 2-3
> times) to confirm that there is no problem.
>
>
> On Wed, 3 Oct 2018 at 15:57, Gael REYNOARD  wrote:
>
> > Sorry for my previous answer, I did not give enough details.
> >
> > So, yes Tomcat start automatically when the OS starts and I only
> installed
> > one instance of the Tomcat service.
> >
> > I thought about this idea of the service that starts twice, but I did not
> > see anything in the log (commons-daemon.2018-10-02.log) that would
> indicate
> > several start of the service.
> >
> > I just checked the Windows events and I only have one Tomcat service run
> > every time Windows starts.
> > This problem does not seem to happen very often because with 102 Windows
> > starts I only had the problem 3 times.
> >
> > Best regards,
> > --
> > *  Gaël REYNOARD* - Ingénieur Recherche & Développement
> >   Service *Bureau d'étude informatique*
> >   44 avenue Victor Meunier - 33530 BASSENS
> >   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
> >   gael.reyno...@lafon.fr - www.lafon.fr
> >
> >
> > Le mer. 3 oct. 2018 à 16:17, Mark Thomas  a écrit :
> >
> >> On 03/10/18 14:54, Gael REYNOARD wrote:
> >> > Tomcat is installed as a service in Windows with a dependency with the
> >> SQL
> >> > Server service.
> >> >
> >> > I can also add when I have this problem, if I manually restart the
> >> Tomcat8
> >> > service, it restarts correctly.
> >>
> >> How are you *starting* Tomcat? Manually starting the service?
> >> Automatically when the OS starts?
> >>
> >> Also, what are the contents of the service wrapper logs?
> >>
> >> It looks like the service is being started twice and failing (as
> >> expected) the second time. Or you have two Tomcat services trying to use
> >> the same ports. Or ...
> >>
> >> Mark
> >>
> >>
> >> >
> >> > Best regards,
> >> > --
> >> > *  Gaël REYNOARD* - Ingénieur Recherche & Développement
> >> >   Service *Bureau d'étude informatique*
> >> >   44 avenue Victor Meunier - 33530 BASSENS
> >> >   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
> >> >   gael.reyno...@lafon.fr - www.lafon.fr
> >> >
> >> >
> >> > Le mer. 3 oct. 2018 à 15:40, Mark Thomas  a écrit :
> >> >
> >> >> On 03/10/18 12:28, Gael REYNOARD wrote:
> >> >>> Hello everybody,
> >> >>>
> >> >>> OS : Windows 7 Pro x64
> >> >>> Tomcat : 8.5.31
> >> >>>
> >> >>> On a test bench, I reboot Windows to test one of our C#
> applications.
> >> >>> Sometimes after starting the OS, my Tomcat server fails to
> initialize
> >> >>> because the 8080 or 8009 port would be already used.
> >> >>
> >> >> How are you starting Tomcat?
> >> >>
> >> >> Mark
> >> >>
> >> >>
> >> >>> I changed the default port 8080 by  and I had the same error
> after
> >> >>> several reboots of my OS.
> >> >>>
> >> >>> I check with the NETSTAT -atonb -p TCP command and I have Tomcat
> that
> >> is
> >> >>> listening to port 8080 (or ) and port 8009.
> >> >>>
> >> >>> Attached file catalina log
> >> >>>
> >> >>> In the log the problem occurred on:
> >> >>> - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
> >> >>> NETSTAT Result:
> >> >>>
> >> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
> >> http://0.0.0.0:0>
> >> >>> LISTENING 2640
> >> >>> [Tomcat8.exe]
> >> >>> TCP 0.0.0.0:8080  0.0.0.0:0 <
> >> http://0.0.0.0:0>
> >> >>> LISTENING 2640
> >> >>> [Tomcat8.exe]
> >> >>>
> >> >>> - 02-Oct-2018 10:27:16.722 (port 8080)
> >> >>> NETSTAT Result:
> >> >>>
> >> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
> >> http://0.0.0.0:0>
> >> >>> LISTENING 2828
> >> >>> [Tomcat8.exe]
> >> >>> TCP 0.0.0.0:8080  0.0.0.0:0 <
> >> http://0.0.0.0:0>
> >> >>> LISTENING 2828
> >> >>> [Tomcat8.exe]
> >> >>>
> >> >>> - 02-Oct-2018 12:20:38.289 (port )
> >> >>> NETSTAT Result:
> >> >>>
> >> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
> >> http://0.0.0.0:0>
> >> >>> LISTENING 2780
> >> >>> [Tomcat8.exe]
> >> >>> TCP 0.0.0.0: 

Re: Tomcat custom location for configuration

2018-10-03 Thread Mark Thomas
On 02/10/18 17:41, Amit Pande wrote:
> Hello SMEs,
> 
> I am looking at Tomcat documentation to see if there is a way to move the 
> “/conf” to a custom location and use this path while 
> running the startup/shutdown scripts.

Why? What problem are you trying to solve?

> I have looked at the 
> https://github.com/apache/tomcat85/blob/TOMCAT_8_5_34/java/org/apache/catalina/startup/Catalina.java
>  and confirmed we can pass a -config  to the Tomcat 
> scripts (catalina.bat/sh, startup.bat/sh, etc).
> 
> Wanted to confirm:
> 
> 
>   1.  Why is “-config” option not documented as part of help of the 
> startup/shutdown scripts? Is this a supported configuration that we can use 
> without worrying about future breaking changes in this?

It appears that this dates back to Tomcat 4.0.x (I couldn't find it in
3.3.x). It isn't something that I have seen used very much.

If I had to guess, I'd say the option was added either when server.xml
was the only configuration file or the location of the other
configuration files could be specified in server.xml.

Over the years additional configuration files were added to the default
location and, because the -config option was little used, the
requirement to make that location configurable wasn't considered.

>   2.  Currently, as part of “-config” option we’re able to pass on the path 
> to server.xml only. What is required to be done so that entire Tomcat 
> configuration (conf directory) can be moved to a custom location?

Looks like a fair amount of work as $CATALINA_BASE/conf/ is hard-coded
in a *lot* of places. Making it configurable is going to be very
invasive. There would need to be a very strong justification for a
change along those lines.

>   3.  I am still debugging why, but on Linux setups, I have observed 
> “configtest” script isn’t working with “-config ”. I 
> am seeing “WARNING: Unable to load server configuration from 
> [path_to_server_dot_xml] Configuration error detected!”. Is this know issue 
> on Linux system? It seemed to work fine for Windows.

I suspect it is a bug.

> Appreciate your inputs.

At this point my recommendation would be to look at alternative
solutions rather than using -config. Once we know what the requirement
is, we can provide some advice.

Mark

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



Re: Apache failed to initialize connector

2018-10-03 Thread M. Manna
it looks like you've bound your port 8009 and 8080 with something else
temporarily during windows startup.It may be some port scanning service or
some firewall/ prevention service is blocking all the ports until some
checks are done. And that is why you have this issue intermittently.

As a verification, you can disable auto startup of tomcat service upon
window start. Upon startup, you can start tomcat manually (repeat it 2-3
times) to confirm that there is no problem.


On Wed, 3 Oct 2018 at 15:57, Gael REYNOARD  wrote:

> Sorry for my previous answer, I did not give enough details.
>
> So, yes Tomcat start automatically when the OS starts and I only installed
> one instance of the Tomcat service.
>
> I thought about this idea of the service that starts twice, but I did not
> see anything in the log (commons-daemon.2018-10-02.log) that would indicate
> several start of the service.
>
> I just checked the Windows events and I only have one Tomcat service run
> every time Windows starts.
> This problem does not seem to happen very often because with 102 Windows
> starts I only had the problem 3 times.
>
> Best regards,
> --
> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>   Service *Bureau d'étude informatique*
>   44 avenue Victor Meunier - 33530 BASSENS
>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>   gael.reyno...@lafon.fr - www.lafon.fr
>
>
> Le mer. 3 oct. 2018 à 16:17, Mark Thomas  a écrit :
>
>> On 03/10/18 14:54, Gael REYNOARD wrote:
>> > Tomcat is installed as a service in Windows with a dependency with the
>> SQL
>> > Server service.
>> >
>> > I can also add when I have this problem, if I manually restart the
>> Tomcat8
>> > service, it restarts correctly.
>>
>> How are you *starting* Tomcat? Manually starting the service?
>> Automatically when the OS starts?
>>
>> Also, what are the contents of the service wrapper logs?
>>
>> It looks like the service is being started twice and failing (as
>> expected) the second time. Or you have two Tomcat services trying to use
>> the same ports. Or ...
>>
>> Mark
>>
>>
>> >
>> > Best regards,
>> > --
>> > *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>> >   Service *Bureau d'étude informatique*
>> >   44 avenue Victor Meunier - 33530 BASSENS
>> >   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>> >   gael.reyno...@lafon.fr - www.lafon.fr
>> >
>> >
>> > Le mer. 3 oct. 2018 à 15:40, Mark Thomas  a écrit :
>> >
>> >> On 03/10/18 12:28, Gael REYNOARD wrote:
>> >>> Hello everybody,
>> >>>
>> >>> OS : Windows 7 Pro x64
>> >>> Tomcat : 8.5.31
>> >>>
>> >>> On a test bench, I reboot Windows to test one of our C# applications.
>> >>> Sometimes after starting the OS, my Tomcat server fails to initialize
>> >>> because the 8080 or 8009 port would be already used.
>> >>
>> >> How are you starting Tomcat?
>> >>
>> >> Mark
>> >>
>> >>
>> >>> I changed the default port 8080 by  and I had the same error after
>> >>> several reboots of my OS.
>> >>>
>> >>> I check with the NETSTAT -atonb -p TCP command and I have Tomcat that
>> is
>> >>> listening to port 8080 (or ) and port 8009.
>> >>>
>> >>> Attached file catalina log
>> >>>
>> >>> In the log the problem occurred on:
>> >>> - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
>> >>> NETSTAT Result:
>> >>>
>> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2640
>> >>> [Tomcat8.exe]
>> >>> TCP 0.0.0.0:8080  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2640
>> >>> [Tomcat8.exe]
>> >>>
>> >>> - 02-Oct-2018 10:27:16.722 (port 8080)
>> >>> NETSTAT Result:
>> >>>
>> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2828
>> >>> [Tomcat8.exe]
>> >>> TCP 0.0.0.0:8080  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2828
>> >>> [Tomcat8.exe]
>> >>>
>> >>> - 02-Oct-2018 12:20:38.289 (port )
>> >>> NETSTAT Result:
>> >>>
>> >>> TCP 0.0.0.0:8009  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2780
>> >>> [Tomcat8.exe]
>> >>> TCP 0.0.0.0:  0.0.0.0:0 <
>> http://0.0.0.0:0>
>> >>> LISTENING 2780
>> >>> [Tomcat8.exe]
>> >>>
>> >>>
>> >>> Thank you in advance for your help.
>> >>>
>> >>> Best regards,
>> >>>
>> 
>> >>> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>> >>>   Service *Bureau d'étude informatique*
>> >>>   44 avenue Victor Meunier - 33530 BASSENS
>> >>>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>> >>>   gael.reyno...@lafon.fr  -
>> www.lafon.fr
>> >>> 
>> >>>
>> >>>
>> >>>
>> >>> -
>> >>> To unsubscribe, e-mail: 

Re: Apache failed to initialize connector

2018-10-03 Thread Gael REYNOARD
Sorry for my previous answer, I did not give enough details.

So, yes Tomcat start automatically when the OS starts and I only installed
one instance of the Tomcat service.

I thought about this idea of the service that starts twice, but I did not
see anything in the log (commons-daemon.2018-10-02.log) that would indicate
several start of the service.

I just checked the Windows events and I only have one Tomcat service run
every time Windows starts.
This problem does not seem to happen very often because with 102 Windows
starts I only had the problem 3 times.

Best regards,
--
*  Gaël REYNOARD* - Ingénieur Recherche & Développement
  Service *Bureau d'étude informatique*
  44 avenue Victor Meunier - 33530 BASSENS
  Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
  gael.reyno...@lafon.fr - www.lafon.fr


Le mer. 3 oct. 2018 à 16:17, Mark Thomas  a écrit :

> On 03/10/18 14:54, Gael REYNOARD wrote:
> > Tomcat is installed as a service in Windows with a dependency with the
> SQL
> > Server service.
> >
> > I can also add when I have this problem, if I manually restart the
> Tomcat8
> > service, it restarts correctly.
>
> How are you *starting* Tomcat? Manually starting the service?
> Automatically when the OS starts?
>
> Also, what are the contents of the service wrapper logs?
>
> It looks like the service is being started twice and failing (as
> expected) the second time. Or you have two Tomcat services trying to use
> the same ports. Or ...
>
> Mark
>
>
> >
> > Best regards,
> > --
> > *  Gaël REYNOARD* - Ingénieur Recherche & Développement
> >   Service *Bureau d'étude informatique*
> >   44 avenue Victor Meunier - 33530 BASSENS
> >   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
> >   gael.reyno...@lafon.fr - www.lafon.fr
> >
> >
> > Le mer. 3 oct. 2018 à 15:40, Mark Thomas  a écrit :
> >
> >> On 03/10/18 12:28, Gael REYNOARD wrote:
> >>> Hello everybody,
> >>>
> >>> OS : Windows 7 Pro x64
> >>> Tomcat : 8.5.31
> >>>
> >>> On a test bench, I reboot Windows to test one of our C# applications.
> >>> Sometimes after starting the OS, my Tomcat server fails to initialize
> >>> because the 8080 or 8009 port would be already used.
> >>
> >> How are you starting Tomcat?
> >>
> >> Mark
> >>
> >>
> >>> I changed the default port 8080 by  and I had the same error after
> >>> several reboots of my OS.
> >>>
> >>> I check with the NETSTAT -atonb -p TCP command and I have Tomcat that
> is
> >>> listening to port 8080 (or ) and port 8009.
> >>>
> >>> Attached file catalina log
> >>>
> >>> In the log the problem occurred on:
> >>> - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
> >>> NETSTAT Result:
> >>>
> >>> TCP 0.0.0.0:8009  0.0.0.0:0  >
> >>> LISTENING 2640
> >>> [Tomcat8.exe]
> >>> TCP 0.0.0.0:8080  0.0.0.0:0  >
> >>> LISTENING 2640
> >>> [Tomcat8.exe]
> >>>
> >>> - 02-Oct-2018 10:27:16.722 (port 8080)
> >>> NETSTAT Result:
> >>>
> >>> TCP 0.0.0.0:8009  0.0.0.0:0  >
> >>> LISTENING 2828
> >>> [Tomcat8.exe]
> >>> TCP 0.0.0.0:8080  0.0.0.0:0  >
> >>> LISTENING 2828
> >>> [Tomcat8.exe]
> >>>
> >>> - 02-Oct-2018 12:20:38.289 (port )
> >>> NETSTAT Result:
> >>>
> >>> TCP 0.0.0.0:8009  0.0.0.0:0  >
> >>> LISTENING 2780
> >>> [Tomcat8.exe]
> >>> TCP 0.0.0.0:  0.0.0.0:0  >
> >>> LISTENING 2780
> >>> [Tomcat8.exe]
> >>>
> >>>
> >>> Thank you in advance for your help.
> >>>
> >>> Best regards,
> >>>
> 
> >>> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
> >>>   Service *Bureau d'étude informatique*
> >>>   44 avenue Victor Meunier - 33530 BASSENS
> >>>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
> >>>   gael.reyno...@lafon.fr  -
> www.lafon.fr
> >>> 
> >>>
> >>>
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>
> >>
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

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

Re: Apache failed to initialize connector

2018-10-03 Thread Mark Thomas
On 03/10/18 14:54, Gael REYNOARD wrote:
> Tomcat is installed as a service in Windows with a dependency with the SQL
> Server service.
> 
> I can also add when I have this problem, if I manually restart the Tomcat8
> service, it restarts correctly.

How are you *starting* Tomcat? Manually starting the service?
Automatically when the OS starts?

Also, what are the contents of the service wrapper logs?

It looks like the service is being started twice and failing (as
expected) the second time. Or you have two Tomcat services trying to use
the same ports. Or ...

Mark


> 
> Best regards,
> --
> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>   Service *Bureau d'étude informatique*
>   44 avenue Victor Meunier - 33530 BASSENS
>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>   gael.reyno...@lafon.fr - www.lafon.fr
> 
> 
> Le mer. 3 oct. 2018 à 15:40, Mark Thomas  a écrit :
> 
>> On 03/10/18 12:28, Gael REYNOARD wrote:
>>> Hello everybody,
>>>
>>> OS : Windows 7 Pro x64
>>> Tomcat : 8.5.31
>>>
>>> On a test bench, I reboot Windows to test one of our C# applications.
>>> Sometimes after starting the OS, my Tomcat server fails to initialize
>>> because the 8080 or 8009 port would be already used.
>>
>> How are you starting Tomcat?
>>
>> Mark
>>
>>
>>> I changed the default port 8080 by  and I had the same error after
>>> several reboots of my OS.
>>>
>>> I check with the NETSTAT -atonb -p TCP command and I have Tomcat that is
>>> listening to port 8080 (or ) and port 8009.
>>>
>>> Attached file catalina log
>>>
>>> In the log the problem occurred on:
>>> - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
>>> NETSTAT Result:
>>>
>>> TCP 0.0.0.0:8009  0.0.0.0:0 
>>> LISTENING 2640
>>> [Tomcat8.exe]
>>> TCP 0.0.0.0:8080  0.0.0.0:0 
>>> LISTENING 2640
>>> [Tomcat8.exe]
>>>
>>> - 02-Oct-2018 10:27:16.722 (port 8080)
>>> NETSTAT Result:
>>>
>>> TCP 0.0.0.0:8009  0.0.0.0:0 
>>> LISTENING 2828
>>> [Tomcat8.exe]
>>> TCP 0.0.0.0:8080  0.0.0.0:0 
>>> LISTENING 2828
>>> [Tomcat8.exe]
>>>
>>> - 02-Oct-2018 12:20:38.289 (port )
>>> NETSTAT Result:
>>>
>>> TCP 0.0.0.0:8009  0.0.0.0:0 
>>> LISTENING 2780
>>> [Tomcat8.exe]
>>> TCP 0.0.0.0:  0.0.0.0:0 
>>> LISTENING 2780
>>> [Tomcat8.exe]
>>>
>>>
>>> Thank you in advance for your help.
>>>
>>> Best regards,
>>> 
>>> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>>>   Service *Bureau d'étude informatique*
>>>   44 avenue Victor Meunier - 33530 BASSENS
>>>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>>>   gael.reyno...@lafon.fr  - www.lafon.fr
>>> 
>>>
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
> 


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



Re: Apache failed to initialize connector

2018-10-03 Thread Gael REYNOARD
Tomcat is installed as a service in Windows with a dependency with the SQL
Server service.

I can also add when I have this problem, if I manually restart the Tomcat8
service, it restarts correctly.

Best regards,
--
*  Gaël REYNOARD* - Ingénieur Recherche & Développement
  Service *Bureau d'étude informatique*
  44 avenue Victor Meunier - 33530 BASSENS
  Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
  gael.reyno...@lafon.fr - www.lafon.fr


Le mer. 3 oct. 2018 à 15:40, Mark Thomas  a écrit :

> On 03/10/18 12:28, Gael REYNOARD wrote:
> > Hello everybody,
> >
> > OS : Windows 7 Pro x64
> > Tomcat : 8.5.31
> >
> > On a test bench, I reboot Windows to test one of our C# applications.
> > Sometimes after starting the OS, my Tomcat server fails to initialize
> > because the 8080 or 8009 port would be already used.
>
> How are you starting Tomcat?
>
> Mark
>
>
> > I changed the default port 8080 by  and I had the same error after
> > several reboots of my OS.
> >
> > I check with the NETSTAT -atonb -p TCP command and I have Tomcat that is
> > listening to port 8080 (or ) and port 8009.
> >
> > Attached file catalina log
> >
> > In the log the problem occurred on:
> > - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
> > NETSTAT Result:
> >
> > TCP 0.0.0.0:8009  0.0.0.0:0 
> > LISTENING 2640
> > [Tomcat8.exe]
> > TCP 0.0.0.0:8080  0.0.0.0:0 
> > LISTENING 2640
> > [Tomcat8.exe]
> >
> > - 02-Oct-2018 10:27:16.722 (port 8080)
> > NETSTAT Result:
> >
> > TCP 0.0.0.0:8009  0.0.0.0:0 
> > LISTENING 2828
> > [Tomcat8.exe]
> > TCP 0.0.0.0:8080  0.0.0.0:0 
> > LISTENING 2828
> > [Tomcat8.exe]
> >
> > - 02-Oct-2018 12:20:38.289 (port )
> > NETSTAT Result:
> >
> > TCP 0.0.0.0:8009  0.0.0.0:0 
> > LISTENING 2780
> > [Tomcat8.exe]
> > TCP 0.0.0.0:  0.0.0.0:0 
> > LISTENING 2780
> > [Tomcat8.exe]
> >
> >
> > Thank you in advance for your help.
> >
> > Best regards,
> > 
> > *  Gaël REYNOARD* - Ingénieur Recherche & Développement
> >   Service *Bureau d'étude informatique*
> >   44 avenue Victor Meunier - 33530 BASSENS
> >   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
> >   gael.reyno...@lafon.fr  - www.lafon.fr
> > 
> >
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Apache failed to initialize connector

2018-10-03 Thread Mark Thomas
On 03/10/18 12:28, Gael REYNOARD wrote:
> Hello everybody,
> 
> OS : Windows 7 Pro x64
> Tomcat : 8.5.31
> 
> On a test bench, I reboot Windows to test one of our C# applications.
> Sometimes after starting the OS, my Tomcat server fails to initialize
> because the 8080 or 8009 port would be already used.

How are you starting Tomcat?

Mark


> I changed the default port 8080 by  and I had the same error after
> several reboots of my OS.
> 
> I check with the NETSTAT -atonb -p TCP command and I have Tomcat that is
> listening to port 8080 (or ) and port 8009.
> 
> Attached file catalina log
>  
> In the log the problem occurred on:
> - 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
> NETSTAT Result:
> 
> TCP 0.0.0.0:8009  0.0.0.0:0 
> LISTENING 2640
> [Tomcat8.exe]
> TCP 0.0.0.0:8080  0.0.0.0:0 
> LISTENING 2640
> [Tomcat8.exe]
> 
> - 02-Oct-2018 10:27:16.722 (port 8080)
> NETSTAT Result:
> 
> TCP 0.0.0.0:8009  0.0.0.0:0 
> LISTENING 2828
> [Tomcat8.exe]
> TCP 0.0.0.0:8080  0.0.0.0:0 
> LISTENING 2828
> [Tomcat8.exe]
> 
> - 02-Oct-2018 12:20:38.289 (port )
> NETSTAT Result:
> 
> TCP 0.0.0.0:8009  0.0.0.0:0 
> LISTENING 2780
> [Tomcat8.exe]
> TCP 0.0.0.0:  0.0.0.0:0 
> LISTENING 2780
> [Tomcat8.exe]
> 
> 
> Thank you in advance for your help.
> 
> Best regards,
> 
> *  Gaël REYNOARD* - Ingénieur Recherche & Développement
>   Service *Bureau d'étude informatique*
>   44 avenue Victor Meunier - 33530 BASSENS
>   Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
>   gael.reyno...@lafon.fr  - www.lafon.fr
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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



Apache failed to initialize connector

2018-10-03 Thread Gael REYNOARD
Hello everybody,

OS : Windows 7 Pro x64
Tomcat : 8.5.31

On a test bench, I reboot Windows to test one of our C# applications.
Sometimes after starting the OS, my Tomcat server fails to initialize
because the 8080 or 8009 port would be already used.
I changed the default port 8080 by  and I had the same error after
several reboots of my OS.

I check with the NETSTAT -atonb -p TCP command and I have Tomcat that is
listening to port 8080 (or ) and port 8009.

Attached file catalina log

In the log the problem occurred on:
- 02-Oct-2018 03:16:41.364 (port 8080 and 8009)
NETSTAT Result:

TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 2640
[Tomcat8.exe]
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2640
[Tomcat8.exe]

- 02-Oct-2018 10:27:16.722 (port 8080)
NETSTAT Result:

TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 2828
[Tomcat8.exe]
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2828
[Tomcat8.exe]

- 02-Oct-2018 12:20:38.289 (port )
NETSTAT Result:

TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 2780
[Tomcat8.exe]
TCP 0.0.0.0: 0.0.0.0:0 LISTENING 2780
[Tomcat8.exe]


Thank you in advance for your help.

Best regards,
--
*  Gaël REYNOARD* - Ingénieur Recherche & Développement
  Service *Bureau d'étude informatique*
  44 avenue Victor Meunier - 33530 BASSENS
  Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
  gael.reyno...@lafon.fr - www.lafon.fr

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

Re: [Bug 62798] Apache failed to initialize connector

2018-10-03 Thread Mark Thomas
On 03/10/18 11:04, Gael REYNOARD wrote:
> Hello,
> 
> Tomcat 8.5.31
> 
> I have read your answer from BugZilla but how Tomcat is possible that
> Tomcat was not completely stopped because I do not just stop the Tomcat
> service. I always reboot my operating system.
> And it's during the startup of Windows that I have sometimes this error.

Please restate your problem for the benefit of the user list subscribers
who will not have seen your bugzilla report.

Mark

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



Re: Incorrect decoding of encoded HTTP headers

2018-10-03 Thread Michael Osipov

Am 2018-10-03 um 11:22 schrieb Jean Pierre Urkens:

Hi everybody,

  


I am having an issue where Unicode characters (e.g.  and & #105;) are
passed by the Apache Webserver 2.4 to Tomcat as UTF-8 encoded bytes while
Tomcat seems to evaluate them as ISO-8859-15 encoded.

  


Having taken a network trace with TCPDUMP I see the following bytes for my
header field (truncated the output after byte ‘72’):

0200   0a 48 54 54 50 5f 56 6f 6f 72 6e 61 61 6d 3a 20   .HTTP_Voornaam:

0210   4d 61 c5 82 67 6f 72
MaÅ.gor

  


Here the bytes C582 is the UTF-8 encoded value for the Unicode character


  


Now when inspecting the header value in Tomcat using:

String headerValue = request.getHeader("HTTP_Voornaam");

  


I’m getting the value ‘MaÅ.gor’ which seems to be using the ISO-8859-15
repesentation for the bytes C582. The byte string from the TCPDUMP seems to
match the result of  headerValue.getBytes(Charset.forName("ISO-8859-15"))
and not the result of headerValue.getBytes(Charset.forName("UTF-8")).

  


The FAQ (https://wiki.apache.org/tomcat/FAQ/CharacterEncoding) indicates
that ‘headers are always in US-ASCII encoding. Anything outside of that
needs to be encoded’, in this case it seems to be UTF-8 encoded.

The headers are evaluated by a servlet 2.5 web application which has defined
a ‘CharacterEncodingFilter’ as first filter performing the following
actions:

  request.setCharacterEncoding("UTF-8");

  response.setContentType("text/html; charset=UTF-8");

  response.setCharacterEncoding("UTF-8");

  filterChain.doFilter(request, response);

  


Is there a way to tell Tomcat to decode the headers as being UTF-8 encoded
bytes?


This is not defined and do not expect it to work properly. The best and 
morstreliable you can do is to encode your values with 
https://tools.ietf.org/html/rfc5987. This is the same approach done for 
Content-Disposition filename qualifier. You may want to evaluate mod_lua 
for that.


Everything else will make you suffer as you have seen.

Michael


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



[Bug 62798] Apache failed to initialize connector

2018-10-03 Thread Gael REYNOARD
Hello,

Tomcat 8.5.31

I have read your answer from BugZilla but how Tomcat is possible that
Tomcat was not completely stopped because I do not just stop the Tomcat
service. I always reboot my operating system.
And it's during the startup of Windows that I have sometimes this error.

Best regards,
--
*  Gaël REYNOARD* - Ingénieur Recherche & Développement
  Service *Bureau d'étude informatique*
  44 avenue Victor Meunier - 33530 BASSENS
  Fixe 05.57.80.80.80 - Fax 05.56.31.61.21 - Poste interne 100 235
  gael.reyno...@lafon.fr - www.lafon.fr


Re: Incorrect decoding of encoded HTTP headers

2018-10-03 Thread Mark Thomas
On 03/10/18 10:22, Jean Pierre Urkens wrote:
> Hi everybody,
> 
> I am having an issue where Unicode characters (e.g.  and & #105;) are
> passed by the Apache Webserver 2.4 to Tomcat as UTF-8 encoded bytes while
> Tomcat seems to evaluate them as ISO-8859-15 encoded.
> 
> Having taken a network trace with TCPDUMP I see the following bytes for my
> header field (truncated the output after byte ‘72’): 
> 
> 0200   0a 48 54 54 50 5f 56 6f 6f 72 6e 61 61 6d 3a 20   .HTTP_Voornaam: 
> 0210   4d 61 c5 82 67 6f 72
> MaÅ.gor
> 
>  
> 
> Here the bytes C582 is the UTF-8 encoded value for the Unicode character
> 
> 
> Now when inspecting the header value in Tomcat using:
> 
>String headerValue = request.getHeader("HTTP_Voornaam");
> 
> I’m getting the value ‘MaÅ.gor’ which seems to be using the ISO-8859-15
> repesentation for the bytes C582. The byte string from the TCPDUMP seems to
> match the result of  headerValue.getBytes(Charset.forName("ISO-8859-15"))
> and not the result of headerValue.getBytes(Charset.forName("UTF-8")).
> 
> The FAQ (https://wiki.apache.org/tomcat/FAQ/CharacterEncoding) indicates
> that ‘headers are always in US-ASCII encoding. Anything outside of that
> needs to be encoded’, in this case it seems to be UTF-8 encoded.

>From the HTTP spec:


   Historically, HTTP has allowed field content with text in the
   ISO-8859-1 charset [ISO-8859-1], supporting other charsets only
   through use of [RFC2047] encoding.  In practice, most HTTP header
   field values use only a subset of the US-ASCII charset [USASCII].
   Newly defined header fields SHOULD limit their field values to
   US-ASCII octets.  A recipient SHOULD treat other octets in field
   content (obs-text) as opaque data.


Sending raw UTF-8 bytes and having them decoded as such has newer been
part of the Servlet spec (and is discouraged by the HTTP spec).

Tomcat has never supported the use of RFC2047 encoding. It has been
considered in the past but I'm not aware of any mainstream client that
supports it.

Tomcat does allow raw UTF-8 in the cookie header (although neither the
Cookie nor the HTTP spec allows this) because most (all major?) browsers
sent raw UTF-8 in the cookie header.

If you know that the data is always going to be UTF-8 then you can do
the (fairly ugly):

String utf8Value = new String(
headerValue.getBytes(StandardCharsets.ISO_8859_1),
StandardCharsets.UTF_8);

The servlet spec should probably provide a mechanism to obtain the
header data as bytes and/or decode them using a given encoding.

> The headers are evaluated by a servlet 2.5 web application which has defined
> a ‘CharacterEncodingFilter’ as first filter performing the following
> actions:
> 
>  request.setCharacterEncoding("UTF-8");
>  response.setContentType("text/html; charset=UTF-8");
>  response.setCharacterEncoding("UTF-8");
>  filterChain.doFilter(request, response);

None of those apply to HTTP headers.

> Is there a way to tell Tomcat to decode the headers as being UTF-8 encoded
> bytes?

No.

> I am using Tomcat-version 8.5.32. 

Thanks for providing that information. A lot of people forget.

Mark

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



Incorrect decoding of encoded HTTP headers

2018-10-03 Thread Jean Pierre Urkens
Hi everybody,

 

I am having an issue where Unicode characters (e.g.  and & #105;) are
passed by the Apache Webserver 2.4 to Tomcat as UTF-8 encoded bytes while
Tomcat seems to evaluate them as ISO-8859-15 encoded.

 

Having taken a network trace with TCPDUMP I see the following bytes for my
header field (truncated the output after byte ‘72’): 

0200   0a 48 54 54 50 5f 56 6f 6f 72 6e 61 61 6d 3a 20   .HTTP_Voornaam: 

0210   4d 61 c5 82 67 6f 72
MaÅ.gor

 

Here the bytes C582 is the UTF-8 encoded value for the Unicode character


 

Now when inspecting the header value in Tomcat using:

   String headerValue = request.getHeader("HTTP_Voornaam");

 

I’m getting the value ‘MaÅ.gor’ which seems to be using the ISO-8859-15
repesentation for the bytes C582. The byte string from the TCPDUMP seems to
match the result of  headerValue.getBytes(Charset.forName("ISO-8859-15"))
and not the result of headerValue.getBytes(Charset.forName("UTF-8")).

 

The FAQ (https://wiki.apache.org/tomcat/FAQ/CharacterEncoding) indicates
that ‘headers are always in US-ASCII encoding. Anything outside of that
needs to be encoded’, in this case it seems to be UTF-8 encoded.

The headers are evaluated by a servlet 2.5 web application which has defined
a ‘CharacterEncodingFilter’ as first filter performing the following
actions:

 request.setCharacterEncoding("UTF-8");

 response.setContentType("text/html; charset=UTF-8");

 response.setCharacterEncoding("UTF-8");

 filterChain.doFilter(request, response);

 

Is there a way to tell Tomcat to decode the headers as being UTF-8 encoded
bytes?

 

I am using Tomcat-version 8.5.32. 

 

Thanks for your support,

 

J.P.