urlcontent *u;
wcsession *WCC = WC;
- if (WCC->urlstrings == NULL)
- WCC->urlstrings = NewHash(1, NULL);
+ if (WCC->Hdr->urlstrings == NULL)
+ WCC->Hdr->urlstrings = NewHash(1, NULL);
eptr = ChrPtr(url) + StrLength(url);
up = ChrPtr(url);
while ((up < eptr) && (!IsEmptyStr(up))) {
continue;
}
- Put(WCC->urlstrings, u->url_key, keylen, u, free_url);
+ Put(WCC->Hdr->urlstrings, u->url_key, keylen, u, free_url);
len = bptr - aptr;
u->url_data = NewStrBufPlain(aptr, len);
StrBufUnescape(u->url_data, 1);
*/
void free_urls(void)
{
- DeleteHash(&WC->urlstrings);
+ DeleteHash(&WC->Hdr->urlstrings);
}
/*
const char *HKey;
HashPos *Cursor;
- Cursor = GetNewHashPos (WCC->urlstrings, 0);
- while (GetNextHashPos(WCC->urlstrings, Cursor, &HKLen, &HKey, &U)) {
+ Cursor = GetNewHashPos (WCC->Hdr->urlstrings, 0);
+ while (GetNextHashPos(WCC->Hdr->urlstrings, Cursor, &HKLen, &HKey, &U)) {
u = (urlcontent*) U;
wprintf("%38s = %s\n", u->url_key, ChrPtr(u->url_data));
}
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U)) {
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U)) {
*len = StrLength(((urlcontent *)U)->url_data);
return ChrPtr(((urlcontent *)U)->url_data);
}
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen (key), &U)){
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen (key), &U)){
*len = StrLength(((urlcontent *)U)->url_data);
return ChrPtr(((urlcontent *)U)->url_data);
}
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen (key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen (key), &U))
return ChrPtr(((urlcontent *)U)->url_data);
else
return ("");
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return ChrPtr(((urlcontent *)U)->url_data);
else
return ("");
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen (key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen (key), &U))
return ((urlcontent *)U)->url_data;
else
return NULL;
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return ((urlcontent *)U)->url_data;
else
return NULL;
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return StrTol(((urlcontent *)U)->url_data);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen(key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen(key), &U))
return StrTol(((urlcontent *)U)->url_data);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return StrTol(((urlcontent *)U)->url_data);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen(key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen(key), &U))
return StrToi(((urlcontent *)U)->url_data);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return (StrLength(((urlcontent *)U)->url_data) != 0);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen(key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen(key), &U))
return (StrLength(((urlcontent *)U)->url_data) != 0);
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, keylen, &U))
return strcmp( ChrPtr(((urlcontent *)U)->url_data), "yes") == 0;
else
return (0);
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen(key), &U))
+ if ((WC->Hdr->urlstrings != NULL) &&
+ GetHash(WC->Hdr->urlstrings, key, strlen(key), &U))
return strcmp( ChrPtr(((urlcontent *)U)->url_data), "yes") == 0;
else
return (0);
#ifdef DEBUG_URLSTRINGS
lprintf(9, "upload_handler() name=%s, type=%s, len=%d\n", name, cbtype, length);
#endif
- if (WC->urlstrings == NULL)
- WC->urlstrings = NewHash(1, NULL);
+ if (WC->Hdr->urlstrings == NULL)
+ WC->Hdr->urlstrings = NewHash(1, NULL);
/* Form fields */
if ( (length > 0) && (IsEmptyStr(cbtype)) ) {
safestrncpy(u->url_key, name, sizeof(u->url_key));
u->url_data = NewStrBufPlain(content, length);
- Put(WC->urlstrings, u->url_key, strlen(u->url_key), u, free_url);
+ Put(WC->Hdr->urlstrings, u->url_key, strlen(u->url_key), u, free_url);
#ifdef DEBUG_URLSTRINGS
lprintf(9, "Key: <%s> len: [%ld] Data: <%s>\n",
u->url_key,
u = (urlcontent*)malloc(sizeof(urlcontent));
memcpy(u->url_key, key, keylen + 1);
u->url_data = Value;
- Put(WC->urlstrings, u->url_key, keylen, u, free_url);
+ Put(WC->Hdr->urlstrings, u->url_key, keylen, u, free_url);
}
output_headers(1, 1, 1, 0, 0, 0);
wprintf("Session: %d<hr />\n", WC->wc_session);
wprintf("Command: <br /><PRE>\n");
- StrEscPuts(WC->UrlFragment1);
+/*
+StrEscPuts(WC->UrlFragment1);
wprintf("<br />\n");
StrEscPuts(WC->UrlFragment2);
wprintf("<br />\n");
StrEscPuts(WC->UrlFragment3);
+*/
wprintf("</PRE><hr />\n");
wprintf("Variables: <br /><PRE>\n");
dump_vars();
wcsession *WCC = WC;
if (WCC != NULL) {
- if (TP->Tokens->Params[0]->lvalue == 0)
- UrlBuf = WCC->UrlFragment1;
- else if (TP->Tokens->Params[0]->lvalue == 1)
- UrlBuf = WCC->UrlFragment2;
- else
- UrlBuf = WCC->UrlFragment3;
+ if (TP->Tokens->Params[0]->lvalue == 0) {
+ UrlBuf = NewStrBuf();
+ StrBufExtract_token(UrlBuf, WCC->Hdr->ReqLine, 1, '/');
+ }
+ else if (TP->Tokens->Params[0]->lvalue == 1) {
+ UrlBuf = NewStrBuf();
+ StrBufExtract_token(UrlBuf, WCC->Hdr->ReqLine, 2, '/');
+ }
+ else {
+ UrlBuf = NewStrBuf();
+ StrBufExtract_token(UrlBuf, WCC->Hdr->ReqLine, 3, '/');
+ }
+
if (UrlBuf == NULL) {
LogTemplateError(Target, "urlbuf", ERR_PARM1, TP, "not set.");
}
StrBufAppendTemplate(Target, TP, UrlBuf, 2);
+ FreeStrBuf(&UrlBuf);
}
}
SessionAttachModule_PARAMHANDLING
(wcsession *sess)
{
- sess->urlstrings = NewHash(1,NULL);
+ sess->Hdr->urlstrings = NewHash(1,NULL);
}
void
SessionDetachModule_PARAMHANDLING
(wcsession *sess)
{
- DeleteHash(&sess->urlstrings);
+ DeleteHash(&sess->Hdr->urlstrings);
}