Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol [HTTP/1.10x0aHost:]

  1. #1
    Junior Member
    Join Date
    Dec 2022
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol [HTTP/1.10x0aHost:]

    Dear Team ,
    I am trying to send Get Http request to our server

    i am using the below request :

    GET /shrMA.pub?msisdn=45454545&startDate=2022-06-01&endDate=2022-10-01 HTTP/1.1
    Host: kmaster
    User-Agent: Server/4.2/1.0
    Authorization: Basic amcdftgAB


    I am getting error


    <!doctype html><html lang="en"><head><title>HTTP Status 400 ... Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 ... Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Invalid character found in the HTTP protocol [HTTP&#47;1.10x0aHost:]</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol [HTTP&#47;1.10x0aHost:]
    org.apache.coyote.http11.Http11InputBuffer.parseRe questLine(Http11InputBuffer.java:574)
    org.apache.coyote.http11.Http11Processor.service(H ttp11Processor.java:502)
    org.apache.coyote.AbstractProcessorLight.process(A bstractProcessorLight.java:65)
    org.apache.coyote.AbstractProtocol$ConnectionHandl er.process(AbstractProtocol.java:818)
    org.apache.tomcat.util.net.NioEndpoint$SocketProce ssor.doRun(NioEndpoint.java:1626)
    org.apache.tomcat.util.net.SocketProcessorBase.run (SocketProcessorBase.java:49)
    java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1149)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    org.apache.tomcat.util.threads.TaskThread$Wrapping Runnable.run(TaskThread.java:61)
    java.lang.Thread.run(Thread.java:748)
    </pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /></body></html>




    Java code :

    request = "GET /shrMA.pub?msisdn=" + msisdn + "&startDate=" + datestart + "&endDate=" + enddate + " HTTP/1.1\n"
    + "Host: kmaster \r\nUser-Agent: Server/4.2/1.0\r\nAuthorization: Basic amcdftgAB\r\n\n";


    Can you please clarify what is issue ?



    NB : the same request work perfectly through telnet .

    Thanks

    Best Regards
    Last edited by Mariaabid; December 1st, 2022 at 01:44 AM.

Similar Threads

  1. java.lang.IllegalArgumentException: Cannot format given Object as a Date
    By kennethdizon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 5th, 2014, 09:05 AM
  2. Sockets and Get of Http protocol
    By dancer_rcd in forum Java Networking
    Replies: 5
    Last Post: January 28th, 2013, 07:44 PM
  3. java.lang.IllegalArgumentException: Identifier not found
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 9
    Last Post: March 9th, 2012, 04:48 AM
  4. java.lang.IllegalArgumentException: im == null!
    By simantoch in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: April 10th, 2011, 02:15 PM
  5. The character '' is an invalid XML character exception getting
    By sumanta in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 9th, 2010, 12:13 PM