[En-Nut-Discussion] HTTP QueryString parser

Lars Andersson laran at ikp.liu.se
Wed Sep 10 18:10:01 CEST 2003


Hi,

I have tried some of your functions and with mixed success.
When I do the following operation the processor sometimes hang and most of the time the output strings ook very strange.

char *cpn;
char *cpv;
u_char i;
u_char count;

count=NutHttpGetParameterCount(req);
for (i =0 ; i < count; i++)
	{
		cpn=NutHttpGetParameterName(req, i);
		cpv=NutHttpGetParameterValue(req, i);
		printf("%s:%s\n\r",cpn,cpv);
	}

please advise,

Regards,
/Lars



-----Original Message-----
From: Mikael Adolfsson [mailto:ethernut at ma.stendahls.net]
Sent: den 8 september 2003 00:18
To: en-nut-discussion at egnite.de
Subject: [En-Nut-Discussion] HTTP QueryString parser


Hi,

I've made some modifications to the pro/httpd to make it able to parse the
QueryString into a decoded table, so you can access form parameters more
easily. Feel free to use it, or put it into the Nut/OS source, if you find
it usefull. 

Please note that this code is not tested on the ethernut board. It's only
tested on my homebuilt hardware, but should work fine on ethernut as well.

In the attached .zip-file, you'll find both the modified source-files and 
their coresponding patch-files.

The added functions are:
char *NutHttpURLEncode (char *str);
void NutHttpURLDecode (char *str);
char *NutHttpGetParameter (REQUEST *req, char *name);
int NutHttpGetParameterCount (REQUEST *req);
char *NutHttpGetParameterName (REQUEST *req, int index);
char *NutHttpGetParameterValue (REQUEST *req, int index);

Btw, I have a (very unfinished) smtp-module as well if someone is 
interested. I've found it usefull to let the board notify me by email on 
special events etc. At the moment this module can only send simple mails.

Mikael



More information about the En-Nut-Discussion mailing list