RestComm / jain-slee

The World's #1 Open Source JAIN-SLEE (JSLEE) 1.1 Implementation
http://www.restcomm.com/
GNU Affero General Public License v3.0
24 stars 50 forks source link

400 Bad Request not sent in the case of invalid INVITE request #111

Closed ThE-MaRaC closed 6 years ago

ThE-MaRaC commented 7 years ago

In the case of INVITE with negative content length 400 Bad Request is not sent.

Exception: 06:44:58,252 DEBUG [UDPMessageChannel] (SipRA-UDPMessageChannelThread-7) error message Content-Length: -329 :For input string: "" 06:44:58,252 ERROR [UDPMessageChannel] (SipRA-UDPMessageChannelThread-7) Error java.text.ParseException: Content-Length: -329 :For input string: "" at gov.nist.javax.sip.parser.Parser.createParseException(Parser.java:45) at gov.nist.javax.sip.parser.ContentLengthParser.parse(ContentLengthParser.java:66) at gov.nist.javax.sip.parser.StringMsgParser.processHeader(StringMsgParser.java:294) at gov.nist.javax.sip.parser.StringMsgParser.parseSIPMessage(StringMsgParser.java:161) at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:359) at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:319) at java.lang.Thread.run(Thread.java:745) 06:44:58,253 DEBUG [UDPMessageChannel] (SipRA-UDPMessageChannelThread-7) Could not formulate automatic 400 Bad Request

SIPP TC is attached. client_negative_content_length.xml.zip

In the case of INVITE with missing Contact header 400 Bad Request is also not sent.

06:43:43,191 DEBUG [SipResourceAdaptor] (SipRA-UDPMessageChannelThread-6) Failed to create server tx in provider javax.sip.TransactionUnavailableException: Missing a required header : Contact at gov.nist.javax.sip.SipProviderImpl.getNewServerTransaction(SipProviderImpl.java:476) at org.mobicents.slee.resource.sip11.SipResourceAdaptor.processNotCancelRequest(SipResourceAdaptor.java:465) at org.mobicents.slee.resource.sip11.SipResourceAdaptor.processRequest(SipResourceAdaptor.java:268) at gov.nist.javax.sip.EventScanner.deliverRequestEvent(EventScanner.java:250) at gov.nist.javax.sip.EventScanner.deliverEvent(EventScanner.java:146) at gov.nist.javax.sip.SipProviderImpl.handleEvent(SipProviderImpl.java:185) at gov.nist.javax.sip.DialogFilter.processRequest(DialogFilter.java:1324) at gov.nist.javax.sip.stack.SIPServerTransactionImpl.processRequest(SIPServerTransactionImpl.java:811) at gov.nist.javax.sip.stack.UDPMessageChannel.processMessage(UDPMessageChannel.java:568) at gov.nist.javax.sip.stack.UDPMessageChannel.processIncomingDataPacket(UDPMessageChannel.java:514) at gov.nist.javax.sip.stack.UDPMessageChannel.run(UDPMessageChannel.java:319) at java.lang.Thread.run(Thread.java:745) Caused by: java.text.ParseException: Missing a required header : Contact at gov.nist.javax.sip.message.SIPRequest.checkHeaders(SIPRequest.java:313) at gov.nist.javax.sip.SipProviderImpl.getNewServerTransaction(SipProviderImpl.java:474) ... 11 more

SIPP TC is attached. client_no_contact.xml.zip

Regards, ThE-MaRaC

deruelle commented 7 years ago

Thanks @ThE-MaRaC for the bug report. Do you want to try to contribute a fix for it ? (This should be done at JAIN SIP level https://github.com/RestComm/jain-sip )

ThE-MaRaC commented 7 years ago

Yes, of course, but 1st I would like to run all my tests on your platform, then I can also fix them :-)

deruelle commented 7 years ago

@ThE-MaRaC great. Which tests are you running ?

ThE-MaRaC commented 7 years ago

[mario_hercog@restcomm jain-sip]$ git ls-files -m src/gov/nist/core/Debug.java src/gov/nist/core/LexerCore.java src/gov/nist/javax/sip/SipProviderImpl.java src/gov/nist/javax/sip/parser/Parser.java src/gov/nist/javax/sip/stack/TCPMessageChannel.java src/gov/nist/javax/sip/stack/TLSMessageChannel.java src/gov/nist/javax/sip/stack/UDPMessageChannel.java jain_sip_issue_111.tar.gz

I would appreciate if someone can review my changes, specially SipProviderImpl.java.

Regards, ThE-MaRaC

deruelle commented 7 years ago

@ThE-MaRaC sharing files make reviews very painful. Can you please follow the guidelines in our Open Source Playbook https://docs.google.com/document/d/1RZz2nd2ivCK_rg1vKX9ansgNF6NpK_PZl81GxZ2MSnM/edit# and do a formal Github Pull Request with your changes ? Also can you please sign the Contributor License Agreement at https://telestax.com/open-source/#Contribute so we can accept any contributions from you ?

ThE-MaRaC commented 7 years ago

Github Pull Request: https://github.com/RestComm/jain-sip/pull/149

I will provide Contributor License Agreement on Monday, hopefully that's OK.

Regards, Hercog Mario

deruelle commented 7 years ago

Thanks @ThE-MaRaC were you able to sign the CLA ?

ThE-MaRaC commented 7 years ago

@deruelle sorry for a delay, I just signed it

satanatoly commented 6 years ago

issue related to jain sip and not jain slee