author | Michael Krelin <hacker@klever.net> | 2008-03-02 20:57:57 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-03-02 20:57:57 (UTC) |
commit | f6482fb9003e4953f838ba4ef2c110190355622f (patch) (unidiff) | |
tree | 978ff6a8647c008cb3726c604b0749edb622171c /lib/openid_message.cc | |
parent | da3f84153be2a93da7ffc49af33b29b9725fac38 (diff) | |
download | libopkele-f6482fb9003e4953f838ba4ef2c110190355622f.zip libopkele-f6482fb9003e4953f838ba4ef2c110190355622f.tar.gz libopkele-f6482fb9003e4953f838ba4ef2c110190355622f.tar.bz2 |
reinstated prefix handling in query building
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/openid_message.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/openid_message.cc b/lib/openid_message.cc index 75e59b3..4b9179b 100644 --- a/lib/openid_message.cc +++ b/lib/openid_message.cc | |||
@@ -67,13 +67,14 @@ namespace opkele { | |||
67 | const basic_openid_message& om; | 67 | const basic_openid_message& om; |
68 | bool first; | 68 | bool first; |
69 | string& rv; | 69 | string& rv; |
70 | const char *pfx; | ||
70 | 71 | ||
71 | __om_query_builder(string& r,const basic_openid_message& m) | 72 | __om_query_builder(const char *p,string& r,const basic_openid_message& m) |
72 | : om(m), first(true), rv(r) { | 73 | : om(m), first(true), rv(r), pfx(p) { |
73 | for_each(om.fields_begin(),om.fields_end(),*this); | 74 | for_each(om.fields_begin(),om.fields_end(),*this); |
74 | } | 75 | } |
75 | __om_query_builder(string& r,const basic_openid_message& m,const string& u) | 76 | __om_query_builder(const char *p,string& r,const basic_openid_message& m,const string& u) |
76 | : om(m), first(true), rv(r) { | 77 | : om(m), first(true), rv(r), pfx(p) { |
77 | rv = u; | 78 | rv = u; |
78 | if(rv.find('?')==string::npos) | 79 | if(rv.find('?')==string::npos) |
79 | rv += '?'; | 80 | rv += '?'; |
@@ -87,19 +88,20 @@ namespace opkele { | |||
87 | first = false; | 88 | first = false; |
88 | else | 89 | else |
89 | rv += '&'; | 90 | rv += '&'; |
90 | rv += "openid."; rv+= f; | 91 | if(pfx) rv += pfx; |
92 | rv+= f; | ||
91 | rv += '='; | 93 | rv += '='; |
92 | rv += util::url_encode(om.get_field(f)); | 94 | rv += util::url_encode(om.get_field(f)); |
93 | } | 95 | } |
94 | }; | 96 | }; |
95 | 97 | ||
96 | string basic_openid_message::append_query(const string& url) const { | 98 | string basic_openid_message::append_query(const string& url,const char *pfx) const { |
97 | string rv; | 99 | string rv; |
98 | return __om_query_builder(rv,*this,url).rv; | 100 | return __om_query_builder(pfx,rv,*this,url).rv; |
99 | } | 101 | } |
100 | string basic_openid_message::query_string() const { | 102 | string basic_openid_message::query_string(const char *pfx) const { |
101 | string rv; | 103 | string rv; |
102 | return __om_query_builder(rv,*this).rv; | 104 | return __om_query_builder(pfx,rv,*this).rv; |
103 | } | 105 | } |
104 | 106 | ||
105 | void basic_openid_message::reset_fields() { | 107 | void basic_openid_message::reset_fields() { |