Part Number:MSP432E401Y
Tool/software: TI-RTOS
Hi all,
I have the same problem of cookies handling as described in this thread and I have written a small extension to httpserver.c from the NDK to handle the cookies header. (see below)
Identifying the cookies works but now I am not sure how to pass the cookies string to the URL handler in my project (I am using urlsimple.c).
One idea is to extend the process handler, but I am not sure if this is a good idea:
int URLSimple_process(URLHandler_Handle urlHandler, int method,
const char * url, const char * urlArgs,
int contentLength, int ssock, char * cookies)
Any ideas / help is greatly appreciated.
Best regards,
Christian
P.S.
It is a bit annoying that the NDK is not natively supporting cookies. Is there some plan to do this in the future?
My changes to httpserver.c:
// Cookie-fix
// Added additional tag id 6 for cookies
#define TAG_COOKIE 6
#define TAG_CLEN 7
#define TAG_AUTH 8
#define TAG_HOST 9
#define TAG_DONTCARE 10
#define TAG_LASTMETHOD TAG_COOKIE
// Cookie-fix
static int httpExtractTag(char * tag)
{
static int x = 1;
x++;
if (!strncmp("GET", tag, 3)) {
return (TAG_GET) ;
}
if (!strncmp("PUT", tag, 3)) {
return (TAG_PUT);
}
if (!strncmp("PATCH", tag, 5)) {
return (TAG_PATCH);
}
if (!strncmp("DELETE", tag, 6)) {
return (TAG_DELETE);
}
if (!strncmp("POST", tag, 4)) {
return (TAG_POST);
}
if (!strncmp("Content-Length: ", tag, 16)) {
return (TAG_CLEN);
}
if (!strncmp("Host: ", tag, 6)) {
return (TAG_HOST);
}
// Cookie-fix
if (!strncmp("Cookie: ", tag, 8)) {
return (TAG_COOKIE);
}
// Cookie-fix
return (TAG_DONTCARE);
}