File: paramvalue.cc

package info (click to toggle)
crossroads 2.65-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,664 kB
  • ctags: 355
  • sloc: cpp: 4,212; perl: 1,658; xml: 269; makefile: 186; sh: 46
file content (21 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "httpbuffer"

string Httpbuffer::paramvalue (string c) {
    PROFILE("Httpheader::paramvalue");

    string uri = requesturi();
    string match = c;
    if (match[match.size() - 1] != '=')
	match += '=';
    string ret = "";
    size_t pos = uri.find(match);
    if (pos != string::npos) {
	pos += match.size();
	for (char ch = uri[pos];
	     pos < uri.size() && ch != '&' && ch != '?';
	     ch = uri[++pos])
	    ret += ch;
    }
    msg(Mstr("Param value '") + c + Mstr("' : '") + ret + "'\n");
    return ret;
}