[En-Nut-Discussion] How to access the Request in ASP
Rodrigue ROLAND
rodrigue.roland at gmail.com
Wed May 16 10:07:08 CEST 2007
In others words, you need to be able to access to a REQUEST structure
and use this piece of code:
if (req->req_query) {
//...
count = NutHttpGetParameterCount(req);
/* Extract count parameters. */
for (i = 0; i < count; i++) {
name = NutHttpGetParameterName(req, i);
value = NutHttpGetParameterValue(req, i);
/* Send the parameters back to the client. */
fprintf_P(stream, PSTR("%s: %s<BR>\r\n"), name, value);
}
}
I don't know if it's possible to access to such structure...
If you look in the file httpd.c, you should find the function
NutHttpProcessRequest. All http requests are processed in this function.
It calls the function NutHttpQueryString which reads the query from
input stream and parses it into name/value table: it parses your REQUEST
structure. After, the function NutHttpProcessFileRequest is called. It
validates the authorization (NtHttpAuthValidate), process the cgi
(NutCgiProcessRequest) and after process File. The following lines, I
think, are importants:
void (*handler)(FILE *stream, int fd, int file_len, char *http_root,
REQUEST *req);
//...
handler = NutGetMimeHandler(filename);
In fact, I saw in the file asp.c that when you register ASP script, the
following code are executed:
void NutRegisterAsp(void) { NutSetMimeHandler(".asp", NutHttpProcessAsp); }
So when an ASP file is processed, the function NutHttpProcessAsp is
called...
and you could see that this function have a parameter REQUEST* req:
void NutHttpProcessAsp(FILE * stream, int fd, int file_len, char*
http_root, REQUEST *req)
Finally, in this function the ASPCallback function is executed:
ProcessAspFunction(pASPFunction, stream);
You see that we only pass one parameter: stream. It's not very difficult
to modify...
Little note: look at the function ProcessAspFunction, there are 4 ASP
scripts which are registered natively! I didn't know that:
- nut_version.asp
- nut_ip_addr.asp
- nut_ip_mask.asp
- nut_gateway.asp
Rod
Jerzy Rzaniak a écrit :
> Hello,
>
> Is it possible to access current HTTP request (posted values) in the "asp"
> handler?
>
> Regards
>
> Jerzy Rzaniak
>
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
More information about the En-Nut-Discussion
mailing list