author | Michael Krelin <hacker@klever.net> | 2007-01-09 20:04:29 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-01-09 20:04:29 (UTC) |
commit | 46fa1790c6d5e990030d8b2b7ae07cb150a49730 (patch) (unidiff) | |
tree | 115419ff78232cfec478222b372d8c60e15dd0fc | |
parent | adc2d682fa4f0aa83b4359bb212eda616cbe39dd (diff) | |
download | libopkele-46fa1790c6d5e990030d8b2b7ae07cb150a49730.zip libopkele-46fa1790c6d5e990030d8b2b7ae07cb150a49730.tar.gz libopkele-46fa1790c6d5e990030d8b2b7ae07cb150a49730.tar.bz2 |
canonicalization bug - do not add '/' after '?', add it right after hostname if needed.
-rw-r--r-- | lib/consumer.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/consumer.cc b/lib/consumer.cc index cbe0769..bb6358c 100644 --- a/lib/consumer.cc +++ b/lib/consumer.cc | |||
@@ -330,12 +330,19 @@ namespace opkele { | |||
330 | if(i==string::npos) { // primitive. but do we need more? | 330 | if(i==string::npos) { // primitive. but do we need more? |
331 | rv.insert(0,"http://"); | 331 | rv.insert(0,"http://"); |
332 | i = sizeof("http://")-1; | 332 | i = sizeof("http://")-1; |
333 | }else{ | 333 | }else{ |
334 | i += sizeof("://")-1; | 334 | i += sizeof("://")-1; |
335 | } | 335 | } |
336 | if(rv.find('/',i)==string::npos) | 336 | string::size_type qm = rv.find('?',i); |
337 | rv += '/'; | 337 | string::size_type sl = rv.find('/',i); |
338 | if(qm!=string::npos) { | ||
339 | if(sl==string::npos || sl>qm) | ||
340 | rv.insert(qm,1,'/'); | ||
341 | }else{ | ||
342 | if(sl==string::npos) | ||
343 | rv += '/'; | ||
344 | } | ||
338 | return rv; | 345 | return rv; |
339 | } | 346 | } |
340 | 347 | ||
341 | } | 348 | } |