From 8f60a46309b83ca6a32ce1f1b00ee1b48853b71b Mon Sep 17 00:00:00 2001 From: Tapas Sharma Date: Thu, 24 Jan 2019 19:59:02 +0530 Subject: [PATCH] Added / to the regexp --- api.go | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/api.go b/api.go index 2becbe35..e42c80ff 100644 --- a/api.go +++ b/api.go @@ -94,19 +94,18 @@ func New(serviceBroker ServiceBroker, logger lager.Logger, brokerCredentials Bro func AttachRoutes(router *mux.Router, serviceBroker ServiceBroker, logger lager.Logger) { handler := serviceBrokerHandler{serviceBroker: serviceBroker, logger: logger} router.HandleFunc("/v2/catalog", handler.catalog).Methods("GET") - //"")*@)?(?:\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4}:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][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000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=@])*)(?::[0-9]*)?(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@]))*)*|\/(?:(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@]))+)(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@]))*)*)?|(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@]))+)(?:\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@]))*)*|(?!(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@])))(?:\?(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@])|[\x{E000}-\x{F8FF}\x{F0000}-\x{FFFFD}\x{100000}-\x{10FFFD}\/\?])*)?(?:\#(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!\$&'\(\)\*\+,;=:@])|[\/\?])*?$/i" - //URLRegex := "[~\xA0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF\x10000-\x1FFFD\x20000-\x2FFFD\x30000-\x3FFFD\x40000-\x4FFFD\x50000-\x5FFFD\x60000-\x6FFFD\x70000-\x7FFFD\x80000-\x8FFFD\x90000-\x9FFFD\xA0000-\xAFFFD\xB0000-\xBFFFD\xC0000-\xCFFFD\xD0000-\xDFFFD\xE1000-\xEFFFD!$&,;=:A-Za-z0-9]+" - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.getInstance).Methods("GET") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.provision).Methods("PUT") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.deprovision).Methods("DELETE") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/last_operation", handler.lastOperation).Methods("GET") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.update).Methods("PATCH") - - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.getBinding).Methods("GET") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.bind).Methods("PUT") - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}", handler.unbind).Methods("DELETE") - - router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\-\\.\\+\\*\\'\\(\\)]+}/last_operation", handler.lastBindingOperation).Methods("GET") + + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.getInstance).Methods("GET") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.provision).Methods("PUT") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.deprovision).Methods("DELETE") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/last_operation", handler.lastOperation).Methods("GET") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.update).Methods("PATCH") + + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.getBinding).Methods("GET") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.bind).Methods("PUT") + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}", handler.unbind).Methods("DELETE") + + router.HandleFunc("/v2/service_instances/{instance_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/service_bindings/{binding_id:[A-Za-z-0-9?:$&,@;=_!\\/\\-\\.\\+\\*\\'\\(\\)]+}/last_operation", handler.lastBindingOperation).Methods("GET") } type serviceBrokerHandler struct {