Review Board 1.7.22


Fix broken support for 'transport' connection option

Review Request #4083 - Created Feb. 28, 2012 and submitted

Gordon Sim
QPID-3832
Reviewers
aconway, kgiusti, mick
qpid
Previous unification of URL support broke the ability to supply the 'transport' (e.g. tcp, rdma, ssl etc) on a connection. This can still be supplied in the URL itself if the 0-10 URL format is used but the regression should be fixed.

The change in this patch adds a method to the Url class to parse a string without populating any resulting addresses with TCP as the default protocol if none is specified. This allows the protocol in the Address to indicate what was explicitly provided and lets the decision on defaults be taken elsewhere (in this case in the underlying client API). 
New case added to sssl tests that uses a mixture of url and connection-option. Make check passes. 
/trunk/qpid/cpp/include/qpid/Url.h
Revision 1294525 New Change
[20] 49 lines
[+20] [+] struct Url : public std::vector<Address> {
50
    /** URL containing a single address */
50
    /** URL containing a single address */
51
    explicit Url(const Address& addr) { push_back(addr); }
51
    explicit Url(const Address& addr) { push_back(addr); }
52

    
   
52

   
53
    /** Parse url, throw Invalid if invalid. */
53
    /** Parse url, throw Invalid if invalid. */
54
    explicit Url(const std::string& url) { parse(url.c_str()); }
54
    explicit Url(const std::string& url) { parse(url.c_str()); }

    
   
55
    /** Parse url, throw Invalid if invalid. */

    
   
56
    explicit Url(const std::string& url, const std::string& defaultProtocol) { parse(url.c_str(), defaultProtocol); }
55

    
   
57

   
56
    /** Parse url, throw Invalid if invalid. */
58
    /** Parse url, throw Invalid if invalid. */
57
    explicit Url(const char* url) { parse(url); }
59
    explicit Url(const char* url) { parse(url); }
58

    
   
60

   
59
    Url& operator=(const char* s) { parse(s); return *this; }
61
    Url& operator=(const char* s) { parse(s); return *this; }
[+20] [20] 4 lines
[+20] struct Url : public std::vector<Address> {
64

    
   
66

   
65
    /** Replace contents with parsed url
67
    /** Replace contents with parsed url
66
     *@exception Invalid if the url is invalid.
68
     *@exception Invalid if the url is invalid.
67
     */
69
     */
68
    QPID_COMMON_EXTERN void parse(const char* url);
70
    QPID_COMMON_EXTERN void parse(const char* url);

    
   
71
    QPID_COMMON_EXTERN void parse(const char* url, const std::string& defaultProtocol);
69
    QPID_COMMON_INLINE_EXTERN void parse(const std::string& url) { parse(url.c_str()); }
72
    QPID_COMMON_INLINE_EXTERN void parse(const std::string& url) { parse(url.c_str()); }
70

    
   
73

   
71
    /** Replace contesnts with parsed URL. Replace with empty URL if invalid. */
74
    /** Replace contesnts with parsed URL. Replace with empty URL if invalid. */
72
    QPID_COMMON_EXTERN void parseNoThrow(const char* url);
75
    QPID_COMMON_EXTERN void parseNoThrow(const char* url);

    
   
76
    QPID_COMMON_EXTERN void parseNoThrow(const char* url, const std::string& defaultProtocol);
73

    
   
77

   
74
    /** Add a protocol tag to be recognzed in URLs.
78
    /** Add a protocol tag to be recognzed in URLs.
75
     * Only for use by protcol plug-in initializers.
79
     * Only for use by protcol plug-in initializers.
76
     */
80
     */
77
    QPID_COMMON_EXTERN static void addProtocol(const std::string& tag);
81
    QPID_COMMON_EXTERN static void addProtocol(const std::string& tag);
[+20] [20] 22 lines
/trunk/qpid/cpp/src/qpid/Url.cpp
Revision 1294525 New Change
 
/trunk/qpid/cpp/src/qpid/client/Connection.cpp
Revision 1294525 New Change
 
/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
Revision 1294525 New Change
 
/trunk/qpid/cpp/src/tests/ssl_test
Revision 1294525 New Change
 
  1. /trunk/qpid/cpp/include/qpid/Url.h: Loading...
  2. /trunk/qpid/cpp/src/qpid/Url.cpp: Loading...
  3. /trunk/qpid/cpp/src/qpid/client/Connection.cpp: Loading...
  4. /trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp: Loading...
  5. /trunk/qpid/cpp/src/tests/ssl_test: Loading...