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/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/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