C to parse query strings?

I am writing a C / CGI web application. Is there a library for parsing a query string in a view GHashTable? I could write my own, but it seems you should not try to reinvent the wheel.

+5
source share
3 answers

The library uriparsercan parse query strings into key-value pairs.

+3
source

If you really write C and the key set is known, you would be much better off storing the values ​​in structinstead of some bloated hash table. Has a table static const:

  • key name
  • type (integer / string, probably enough)
  • offset ( offsetof)

.

+2

ap_getword Apache Portable Runtime (apr).

ap_getword *, , split() Perl. , , . Perl split(), , , ap_getword * . , , , , .

google "ap_getword(r->pool" "httpd.h" .

0

All Articles