Skip to content

Commit

Permalink
GH #755 - Make sure pub/sub REST endpoints can handle slash characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Dec 6, 2018
1 parent 855e7d4 commit 2e507d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
19 changes: 14 additions & 5 deletions code/zato-cli/src/zato/cli/create_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# stdlib
from copy import deepcopy
from datetime import datetime
from json import dumps
from traceback import format_exc
from uuid import uuid4

Expand Down Expand Up @@ -939,25 +940,33 @@ def add_pubsub_sec_endpoints(self, session, cluster):
service_msg = Service(None, 'zato.pubsub.pubapi.message-service', True, impl_name3, True, cluster)
service_demo = Service(None, 'zato.pubsub.helpers.json-raw-request-logger', True, impl_demo, True, cluster)

# Opaque data that lets clients use topic contain slash characters
opaque = dumps({'match_slash':True})

chan_topic = HTTPSOAP(None, 'zato.pubsub.topic.topic_name', True, True, CONNECTION.CHANNEL,
URL_TYPE.PLAIN_HTTP, None, '/zato/pubsub/topic/{topic_name}',
None, '', None, DATA_FORMAT.JSON, security=None, service=service_topic, cluster=cluster)
None, '', None, DATA_FORMAT.JSON, security=None, service=service_topic, opaque=opaque,
cluster=cluster)

chan_sub = HTTPSOAP(None, 'zato.pubsub.subscribe.topic.topic_name', True, True, CONNECTION.CHANNEL,
URL_TYPE.PLAIN_HTTP, None, '/zato/pubsub/subscribe/topic/{topic_name}',
None, '', None, DATA_FORMAT.JSON, security=None, service=service_sub, cluster=cluster)
None, '', None, DATA_FORMAT.JSON, security=None, service=service_sub, opaque=opaque,
cluster=cluster)

chan_msg = HTTPSOAP(None, 'zato.pubsub.msg.msg_id', True, True, CONNECTION.CHANNEL,
URL_TYPE.PLAIN_HTTP, None, '/zato/pubsub/msg/{msg_id}',
None, '', None, DATA_FORMAT.JSON, security=None, service=service_msg, cluster=cluster)
None, '', None, DATA_FORMAT.JSON, security=None, service=service_msg, opaque=opaque,
cluster=cluster)

chan_demo = HTTPSOAP(None, 'pubsub.demo.sample.channel', True, True, CONNECTION.CHANNEL,
URL_TYPE.PLAIN_HTTP, None, '/zato/pubsub/zato.demo.sample',
None, '', None, DATA_FORMAT.JSON, security=sec_demo, service=service_demo, cluster=cluster)
None, '', None, DATA_FORMAT.JSON, security=sec_demo, service=service_demo, opaque=opaque,
cluster=cluster)

outconn_demo = HTTPSOAP(None, 'pubsub.demo.sample.outconn', True, True, CONNECTION.OUTGOING,
URL_TYPE.PLAIN_HTTP, 'http://localhost:11223', '/zato/pubsub/zato.demo.sample',
None, '', None, DATA_FORMAT.JSON, security=sec_demo, cluster=cluster)
None, '', None, DATA_FORMAT.JSON, security=sec_demo, opaque=opaque,
cluster=cluster)

endpoint_default_internal = PubSubEndpoint()
endpoint_default_internal.name = PUBSUB.DEFAULT.INTERNAL_ENDPOINT_NAME
Expand Down
3 changes: 2 additions & 1 deletion code/zato-common/src/zato/common/odb/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ def __init__(self, id=None, name=None, is_active=None, is_internal=None, connect
timeout=None, sec_tls_ca_cert_id=None, service_id=None, service=None, security=None, cluster_id=None,
cluster=None, service_name=None, security_id=None, has_rbac=None, security_name=None, content_type=None,
cache_id=None, cache_type=None, cache_expiry=None, cache_name=None, content_encoding=None, match_slash=None,
**kwargs):
opaque=None, **kwargs):
super(HTTPSOAP, self).__init__(**kwargs)
self.id = id
self.name = name
Expand Down Expand Up @@ -646,6 +646,7 @@ def __init__(self, id=None, name=None, is_active=None, is_internal=None, connect
self.cache_name = cache_name # Not used by the DB
self.content_encoding = content_encoding
self.match_slash = match_slash # Not used by the DB
self.opaque1 = opaque

# ################################################################################################################################

Expand Down

0 comments on commit 2e507d7

Please sign in to comment.