summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-03-12 15:00:01 -0500
committerEliot Horowitz <eliot@10gen.com>2010-03-12 15:00:01 -0500
commit0797f888001b1fbd4b0c9a802911f315cfe20dd6 (patch)
tree3aead5d3a4e020deb025608df8b690ac233faac9 /util
parent81ff09077c3afce308380751515fec907688966e (diff)
downloadmongo-0797f888001b1fbd4b0c9a802911f315cfe20dd6.tar.gz
use BSONObj for params so order is preserved
Diffstat (limited to 'util')
-rw-r--r--util/miniwebserver.cpp12
-rw-r--r--util/miniwebserver.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/util/miniwebserver.cpp b/util/miniwebserver.cpp
index edd1316f28a..61619d8422a 100644
--- a/util/miniwebserver.cpp
+++ b/util/miniwebserver.cpp
@@ -82,12 +82,13 @@ namespace mongo {
return string( urlStart , (int)(end-urlStart) );
}
- void MiniWebServer::parseParams( map<string,string> & params , string query ) {
+ void MiniWebServer::parseParams( BSONObj & params , string query ) {
if ( query.size() == 0 )
return;
-
+
+ BSONObjBuilder b;
while ( query.size() ) {
-
+
string::size_type amp = query.find( "&" );
string cur;
@@ -104,9 +105,10 @@ namespace mongo {
if ( eq == string::npos )
continue;
- params[urlDecode(cur.substr(0,eq))] = urlDecode(cur.substr(eq+1));
+ b.append( urlDecode(cur.substr(0,eq)).c_str() , urlDecode(cur.substr(eq+1) ) );
}
- return;
+
+ params = b.obj();
}
string MiniWebServer::parseMethod( const char * headers ) {
diff --git a/util/miniwebserver.h b/util/miniwebserver.h
index 12aa56c7ebd..bdd2873a381 100644
--- a/util/miniwebserver.h
+++ b/util/miniwebserver.h
@@ -17,7 +17,9 @@
#pragma once
+#include "../stdafx.h"
#include "message.h"
+#include "../db/jsobj.h"
namespace mongo {
@@ -45,7 +47,7 @@ namespace mongo {
string parseURL( const char * buf );
string parseMethod( const char * headers );
string getHeader( const char * headers , string name );
- void parseParams( map<string,string> & params , string query );
+ void parseParams( BSONObj & params , string query );
static const char *body( const char *buf );
static string urlDecode(const char* s);