You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alex O'Ree <al...@apache.org> on 2018/02/20 21:01:33 UTC

Error parsing HTTP request header, HTTP method names must be tokens

I keep running into the an IllegalArgumentException at or near startup of
tomcat 8.5 with a bunch of cxf web services deployed and I have no idea
what's causing it. The error message mentions turning on logging at the
debug level.

Question: Assuming i need to edit the logging.properties file, which
setting/line do i have to edit to reveal what the root cause is?

Re: Error parsing HTTP request header, HTTP method names must be tokens

Posted by Alex O'Ree <al...@apache.org>.
Thanks. I'll try the logging change to see if i can at least narrow it down
a bit more.

On Wed, Feb 21, 2018 at 7:49 PM, Konstantin Kolinko <kn...@gmail.com>
wrote:

> 2018-02-21 22:19 GMT+03:00 Alex O'Ree <al...@apache.org>:
> > That's the error message. The problem is I have no idea which client it
> is
> > and what character it is sending that is causing the issue. Thus I would
> > like to get the offending header logged in some way.
>
> The "http-nio-8080-exec-3" in the message is the thread name. It can
> be written to the Access Log with "%I"
>
> http://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Access_Logging
>
> Also look for response status in an access log. I think those requests
> are handled with status "400".
>
> You will see an IP address there. You wont't see any headers (such as
> User-Agent) as those have not been parsed yet.
>
> > On Tue, Feb 20, 2018 at 4:25 PM, Coty Sutherland <cs...@apache.org>
> > wrote:
> >
> >> On Tue, Feb 20, 2018 at 4:01 PM, Alex O'Ree <al...@apache.org>
> wrote:
> >> > I keep running into the an IllegalArgumentException at or near
> startup of
> >> > tomcat 8.5 with a bunch of cxf web services deployed and I have no
> idea
> >> > what's causing it. The error message mentions turning on logging at
> the
> >> > debug level.
> >>
> >> Random shot in the dark given the minimal date provided :) Does it
> >> look like this:
> >>
> >> INFO [http-nio-8080-exec-3]
> >> org.apache.coyote.http11.Http11Processor.service Error parsing HTTP
> >> request header
> >>  Note: further occurrences of HTTP request parsing errors will be
> >> logged at DEBUG level.
> >>  java.lang.IllegalArgumentException: Invalid character found in the
> >> request target. The valid characters are defined in RFC 7230 and RFC
> >> 3986
> >>     at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(
> >> Http11InputBuffer.java:460)
> >>     at org.apache.coyote.http11.Http11Processor.service(
> >> Http11Processor.java:291)
> >>     at org.apache.coyote.AbstractProcessorLight.process(
> >> AbstractProcessorLight.java:66)
> >>     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
> >> AbstractProtocol.java:754)
> >>     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> >> doRun(NioEndpoint.java:1376)
> >>     at org.apache.tomcat.util.net.SocketProcessorBase.run(
> >> SocketProcessorBase.java:49)
> >>     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> >> ThreadPoolExecutor.java:1149)
> >>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> >> ThreadPoolExecutor.java:624)
> >>     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
> >> TaskThread.java:61)
> >>     at java.lang.Thread.run(Thread.java:748)
> >>
> >> If so, then your client is sending you requests with unencoded special
> >> characters that are now disallowed by Tomcat.
> >>
>
> >> Question: Assuming i need to edit the logging.properties file, which
> setting/line do i have to edit to reveal what the root cause is?
>
> http://tomcat.apache.org/tomcat-8.5-doc/logging.html
> and also official Java documentation on java.util.logging.
>
> From the log message cited by Coty, I think you need to add
> org.apache.coyote.http11.Http11Processor.level = FINE
>
> In short, you need both
> 1) <log category aka logger>.level = FINE
> 2) <handler>.level = FINE
>
> "1)" controls whether a log event is raised,
> "2)" controls writing it out to a specific output (console, file)
>
> "2)" is already set in the logging.properties file provided by Tomcat.
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Error parsing HTTP request header, HTTP method names must be tokens

Posted by Konstantin Kolinko <kn...@gmail.com>.
2018-02-21 22:19 GMT+03:00 Alex O'Ree <al...@apache.org>:
> That's the error message. The problem is I have no idea which client it is
> and what character it is sending that is causing the issue. Thus I would
> like to get the offending header logged in some way.

The "http-nio-8080-exec-3" in the message is the thread name. It can
be written to the Access Log with "%I"

http://tomcat.apache.org/tomcat-8.5-doc/config/valve.html#Access_Logging

Also look for response status in an access log. I think those requests
are handled with status "400".

You will see an IP address there. You wont't see any headers (such as
User-Agent) as those have not been parsed yet.

> On Tue, Feb 20, 2018 at 4:25 PM, Coty Sutherland <cs...@apache.org>
> wrote:
>
>> On Tue, Feb 20, 2018 at 4:01 PM, Alex O'Ree <al...@apache.org> wrote:
>> > I keep running into the an IllegalArgumentException at or near startup of
>> > tomcat 8.5 with a bunch of cxf web services deployed and I have no idea
>> > what's causing it. The error message mentions turning on logging at the
>> > debug level.
>>
>> Random shot in the dark given the minimal date provided :) Does it
>> look like this:
>>
>> INFO [http-nio-8080-exec-3]
>> org.apache.coyote.http11.Http11Processor.service Error parsing HTTP
>> request header
>>  Note: further occurrences of HTTP request parsing errors will be
>> logged at DEBUG level.
>>  java.lang.IllegalArgumentException: Invalid character found in the
>> request target. The valid characters are defined in RFC 7230 and RFC
>> 3986
>>     at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(
>> Http11InputBuffer.java:460)
>>     at org.apache.coyote.http11.Http11Processor.service(
>> Http11Processor.java:291)
>>     at org.apache.coyote.AbstractProcessorLight.process(
>> AbstractProcessorLight.java:66)
>>     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
>> AbstractProtocol.java:754)
>>     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
>> doRun(NioEndpoint.java:1376)
>>     at org.apache.tomcat.util.net.SocketProcessorBase.run(
>> SocketProcessorBase.java:49)
>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(
>> ThreadPoolExecutor.java:1149)
>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
>> ThreadPoolExecutor.java:624)
>>     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
>> TaskThread.java:61)
>>     at java.lang.Thread.run(Thread.java:748)
>>
>> If so, then your client is sending you requests with unencoded special
>> characters that are now disallowed by Tomcat.
>>

>> Question: Assuming i need to edit the logging.properties file, which
setting/line do i have to edit to reveal what the root cause is?

http://tomcat.apache.org/tomcat-8.5-doc/logging.html
and also official Java documentation on java.util.logging.

From the log message cited by Coty, I think you need to add
org.apache.coyote.http11.Http11Processor.level = FINE

In short, you need both
1) <log category aka logger>.level = FINE
2) <handler>.level = FINE

"1)" controls whether a log event is raised,
"2)" controls writing it out to a specific output (console, file)

"2)" is already set in the logging.properties file provided by Tomcat.

Best regards,
Konstantin Kolinko

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


Re: Error parsing HTTP request header, HTTP method names must be tokens

Posted by Mark Thomas <ma...@apache.org>.
On 21/02/18 19:19, Alex O'Ree wrote:
> That's the error message. The problem is I have no idea which client it is
> and what character it is sending that is causing the issue. Thus I would
> like to get the offending header logged in some way.

That sounds like an enhancement request for the log message to include
the invalid character and a client IP address.

The patch should be fairly simple if you fancy taking a shot at it.

Mark


> 
> On Tue, Feb 20, 2018 at 4:25 PM, Coty Sutherland <cs...@apache.org>
> wrote:
> 
>> On Tue, Feb 20, 2018 at 4:01 PM, Alex O'Ree <al...@apache.org> wrote:
>>> I keep running into the an IllegalArgumentException at or near startup of
>>> tomcat 8.5 with a bunch of cxf web services deployed and I have no idea
>>> what's causing it. The error message mentions turning on logging at the
>>> debug level.
>>
>> Random shot in the dark given the minimal date provided :) Does it
>> look like this:
>>
>> INFO [http-nio-8080-exec-3]
>> org.apache.coyote.http11.Http11Processor.service Error parsing HTTP
>> request header
>>  Note: further occurrences of HTTP request parsing errors will be
>> logged at DEBUG level.
>>  java.lang.IllegalArgumentException: Invalid character found in the
>> request target. The valid characters are defined in RFC 7230 and RFC
>> 3986
>>     at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(
>> Http11InputBuffer.java:460)
>>     at org.apache.coyote.http11.Http11Processor.service(
>> Http11Processor.java:291)
>>     at org.apache.coyote.AbstractProcessorLight.process(
>> AbstractProcessorLight.java:66)
>>     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
>> AbstractProtocol.java:754)
>>     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
>> doRun(NioEndpoint.java:1376)
>>     at org.apache.tomcat.util.net.SocketProcessorBase.run(
>> SocketProcessorBase.java:49)
>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(
>> ThreadPoolExecutor.java:1149)
>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
>> ThreadPoolExecutor.java:624)
>>     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
>> TaskThread.java:61)
>>     at java.lang.Thread.run(Thread.java:748)
>>
>> If so, then your client is sending you requests with unencoded special
>> characters that are now disallowed by Tomcat.
>>
>>> Question: Assuming i need to edit the logging.properties file, which
>>> setting/line do i have to edit to reveal what the root cause is?
>>
>> I can't answer that without more information. What is throwing the
>> exception? A stack trace would be helpful.
>>
>> ---------------------------------------------------------------------
>> 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: Error parsing HTTP request header, HTTP method names must be tokens

Posted by Alex O'Ree <al...@apache.org>.
That's the error message. The problem is I have no idea which client it is
and what character it is sending that is causing the issue. Thus I would
like to get the offending header logged in some way.

On Tue, Feb 20, 2018 at 4:25 PM, Coty Sutherland <cs...@apache.org>
wrote:

> On Tue, Feb 20, 2018 at 4:01 PM, Alex O'Ree <al...@apache.org> wrote:
> > I keep running into the an IllegalArgumentException at or near startup of
> > tomcat 8.5 with a bunch of cxf web services deployed and I have no idea
> > what's causing it. The error message mentions turning on logging at the
> > debug level.
>
> Random shot in the dark given the minimal date provided :) Does it
> look like this:
>
> INFO [http-nio-8080-exec-3]
> org.apache.coyote.http11.Http11Processor.service Error parsing HTTP
> request header
>  Note: further occurrences of HTTP request parsing errors will be
> logged at DEBUG level.
>  java.lang.IllegalArgumentException: Invalid character found in the
> request target. The valid characters are defined in RFC 7230 and RFC
> 3986
>     at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(
> Http11InputBuffer.java:460)
>     at org.apache.coyote.http11.Http11Processor.service(
> Http11Processor.java:291)
>     at org.apache.coyote.AbstractProcessorLight.process(
> AbstractProcessorLight.java:66)
>     at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
> AbstractProtocol.java:754)
>     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> doRun(NioEndpoint.java:1376)
>     at org.apache.tomcat.util.net.SocketProcessorBase.run(
> SocketProcessorBase.java:49)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1149)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:624)
>     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
> TaskThread.java:61)
>     at java.lang.Thread.run(Thread.java:748)
>
> If so, then your client is sending you requests with unencoded special
> characters that are now disallowed by Tomcat.
>
> > Question: Assuming i need to edit the logging.properties file, which
> > setting/line do i have to edit to reveal what the root cause is?
>
> I can't answer that without more information. What is throwing the
> exception? A stack trace would be helpful.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Error parsing HTTP request header, HTTP method names must be tokens

Posted by Coty Sutherland <cs...@apache.org>.
On Tue, Feb 20, 2018 at 4:01 PM, Alex O'Ree <al...@apache.org> wrote:
> I keep running into the an IllegalArgumentException at or near startup of
> tomcat 8.5 with a bunch of cxf web services deployed and I have no idea
> what's causing it. The error message mentions turning on logging at the
> debug level.

Random shot in the dark given the minimal date provided :) Does it
look like this:

INFO [http-nio-8080-exec-3]
org.apache.coyote.http11.Http11Processor.service Error parsing HTTP
request header
 Note: further occurrences of HTTP request parsing errors will be
logged at DEBUG level.
 java.lang.IllegalArgumentException: Invalid character found in the
request target. The valid characters are defined in RFC 7230 and RFC
3986
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:460)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:291)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

If so, then your client is sending you requests with unencoded special
characters that are now disallowed by Tomcat.

> Question: Assuming i need to edit the logging.properties file, which
> setting/line do i have to edit to reveal what the root cause is?

I can't answer that without more information. What is throwing the
exception? A stack trace would be helpful.

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