Fix Bug #68497 Stomp client doesn't parse ERROR response on CONNECT
parent
beb86e70fe
commit
8e18eb079d
|
@ -0,0 +1,28 @@
|
||||||
|
.deps
|
||||||
|
.libs/
|
||||||
|
Makefile
|
||||||
|
Makefile.fragments
|
||||||
|
Makefile.global
|
||||||
|
Makefile.objects
|
||||||
|
acinclude.m4
|
||||||
|
aclocal.m4
|
||||||
|
autom4te.cache/
|
||||||
|
config.guess
|
||||||
|
config.h
|
||||||
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.nice
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
configure.in
|
||||||
|
install-sh
|
||||||
|
libtool
|
||||||
|
ltmain.sh
|
||||||
|
missing
|
||||||
|
mkinstalldirs
|
||||||
|
modules/
|
||||||
|
php_stomp.lo
|
||||||
|
run-tests.php
|
||||||
|
stomp.la
|
||||||
|
stomp.lo
|
13
php_stomp.c
13
php_stomp.c
|
@ -538,11 +538,22 @@ PHP_FUNCTION(stomp_connect)
|
||||||
|
|
||||||
stomp_send(stomp, &frame TSRMLS_CC);
|
stomp_send(stomp, &frame TSRMLS_CC);
|
||||||
CLEAR_FRAME(frame);
|
CLEAR_FRAME(frame);
|
||||||
|
|
||||||
/* Retreive Response */
|
/* Retreive Response */
|
||||||
res = stomp_read_frame(stomp);
|
res = stomp_read_frame(stomp);
|
||||||
if (NULL == res) {
|
if (NULL == res) {
|
||||||
STOMP_ERROR(0, PHP_STOMP_ERR_SERVER_NOT_RESPONDING);
|
STOMP_ERROR(0, PHP_STOMP_ERR_SERVER_NOT_RESPONDING);
|
||||||
|
} else if (0 == strncmp("ERROR", res->command, sizeof("ERROR") - 1)) {
|
||||||
|
char *error_msg = NULL;
|
||||||
|
if (zend_hash_find(res->headers, "message", sizeof("message"), (void **)&error_msg) == SUCCESS) {
|
||||||
|
zval *excobj = zend_throw_exception_ex(stomp_ce_exception, 0 TSRMLS_CC, error_msg);
|
||||||
|
if (res->body) {
|
||||||
|
zend_update_property_string(stomp_ce_exception, excobj, "details", sizeof("details")-1, (char *) res->body TSRMLS_CC);
|
||||||
|
}
|
||||||
|
|
||||||
|
stomp_free_frame(res);
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
} else if (0 != strncmp("CONNECTED", res->command, sizeof("CONNECTED")-1)) {
|
} else if (0 != strncmp("CONNECTED", res->command, sizeof("CONNECTED")-1)) {
|
||||||
if (stomp->error) {
|
if (stomp->error) {
|
||||||
STOMP_ERROR_DETAILS(stomp->errnum, stomp->error, stomp->error_details);
|
STOMP_ERROR_DETAILS(stomp->errnum, stomp->error, stomp->error_details);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
--TEST--
|
||||||
|
Test stomp_connect() - Test error on CONNECT
|
||||||
|
--SKIPIF--
|
||||||
|
<?php if (!extension_loaded("stomp")) print "skip"; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
try {
|
||||||
|
$stomp = new Stomp('tcp://localhost', 'anotpresentusername1234');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
var_dump(get_class($e));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
string(14) "StompException"
|
Loading…
Reference in New Issue