php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70280 php5-stomp should NOT always add 'content-length' header
Submitted: 2015-08-16 12:55 UTC Modified: 2017-10-24 07:05 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: vitalif at mail dot ru Assigned:
Status: Open Package: stomp (PECL)
PHP Version: 5.6.12 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-08-16 12:55 UTC] vitalif at mail dot ru
Description:
------------
Hi!

Now php5-stomp always adds 'content-length' header to all messages being sent. This makes sending JMS "TextMessage" (including XML!) impossible, because most JMS/STOMP queues like OpenMQ or ActiveMQ decide whether the message is JMS "BytesMessage" or "TextMessage" based on the presence of 'content-length' header (as described here: http://activemq.apache.org/stomp.html and here: https://mq.java.net/4.4-content/stomp-funcspec.html). I.e. if it is there, the message is treated as bytes. So JMS can never decode messages sent from php5-stomp as XML, because it wants XML to be TextMessages.

And XML is obviously the thing that you want the most when connecting to a JMS queue via STOMP! :)

So, php5-stomp should provide a way to send messages WITHOUT content-length header. For example you may add a configuration parameter, or you can make the extension only add that header if the message does not contain zero byte.


Patches

php5-stomp-only-binary-content-length.diff (last revision 2015-08-18 09:05 UTC by vitalif at mail dot ru)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-17 22:31 UTC] gena01@php.net
I have to think about this.

From the official stomp 1.1 documentation: 

SEND frames SHOULD include a content-length header and a content-type header if a body is present.

Link: https://stomp.github.io/stomp-specification-1.1.html#SEND

So looks like ActiveMQ might actually be violating the spec and not looking at content-type header or the documentation is wrong?
 [2015-11-17 22:31 UTC] gena01@php.net
-Assigned To: +Assigned To: gena01
 [2017-10-24 07:05 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: gena01 +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 26 21:01:26 2019 UTC