Exemple #1
0
/*
**	Takes a string of the form "a=b" containing HTML form data, escapes
**	it accordingly and puts it into the association list so that it
**	readily can be passed to any of the HTAccess function that handles
**	HTML form data.
*/
PUBLIC BOOL HTParseFormInput (HTAssocList * list, const char * str)
{
    if (list && str) {
	char * me = NULL;
	char * name = NULL;
	char * value = NULL;
	StrAllocCopy(me, str);
	value = strchr(me, '=');
	if (value) 
	    *value++ = '\0';
	else
	    value = "";
	name = HTStrip(me);

	/* Escape the name and value */
	if (name) {
	    char * escaped_name = HTEscape(name, URL_XALPHAS);
	    char * escaped_value = HTEscape(value, URL_XALPHAS);
	    HTTRACE(APP_TRACE, "Form data... Adding name `%s\' with value `%s\' to %p\n" _ 
			escaped_name _ escaped_value _ list);
	    HTAssocList_addObject(list, escaped_name, escaped_value);
	    HT_FREE(escaped_name);
	    HT_FREE(escaped_value);
	}
	HT_FREE(me);
	return YES;
    }
    return NO;
}
Exemple #2
0
PUBLIC BOOL HTResponse_addRange (HTResponse * me, char * unit, char * range)
{
    if (me) {
        if (!me->byte_ranges) me->byte_ranges = HTAssocList_new();
        return HTAssocList_addObject(me->byte_ranges, unit, range);
    }
    return NO;
}
Exemple #3
0
/*
**  Original header information
*/
PUBLIC BOOL HTResponse_addHeader (HTResponse * me,
                                  char * token, char * value)
{
    if (me) {
        if (!me->headers) me->headers = HTAssocList_new();
        return HTAssocList_addObject(me->headers, token, value);
    }
    return NO;
}
Exemple #4
0
/*
**  Trailers
*/
PUBLIC BOOL HTResponse_addTrailer (HTResponse * me,
                                   char * token, char * value)
{
    if (me) {
        if (!me->trailer) me->trailer = HTAssocList_new();
        return HTAssocList_addObject(me->trailer, token, value);
    }
    return NO;
}
Exemple #5
0
/*
**  PEP Protocol request header
*/
PUBLIC BOOL HTResponse_addProtocolRequest (HTResponse * me,
        char * token, char * value)
{
    if (me) {
        if (!me->protocol_request) me->protocol_request = HTAssocList_new();
        return HTAssocList_addObject(me->protocol_request, token,value);
    }
    return NO;
}
Exemple #6
0
/*
**  PEP Protocol Info header
*/
PUBLIC BOOL HTResponse_addProtocolInfo (HTResponse * me,
                                        char * token, char * value)
{
    if (me) {
        if (!me->protocol_info) me->protocol_info = HTAssocList_new();
        return HTAssocList_addObject(me->protocol_info, token,value);
    }
    return NO;
}
Exemple #7
0
/*
**  Access Authentication Challenges
*/
PUBLIC BOOL HTResponse_addChallenge (HTResponse * me,
                                     char * token, char * value)
{
    if (me) {
        if (!me->challenge) me->challenge = HTAssocList_new();
        return HTAssocList_addObject(me->challenge, token, value);
    }
    return NO;
}
Exemple #8
0
PUBLIC BOOL HTAssocList_replaceObject (HTAssocList * list,
				       const char * name, const char * value)
{
    if (list && name) {
	HTAssocList * cur = list;
	HTAssoc * assoc;
	int len = strlen(name);
	while ((assoc = (HTAssoc *) HTList_nextObject(cur))) {
	    if (!strncasecomp(assoc->name, name, len)) {
		StrAllocCopy(assoc->name, name);
		if (value) StrAllocCopy(assoc->value, value);
		return YES;
	    }
	}
	return HTAssocList_addObject(list, name, value);
    }
    return NO;
}
Exemple #9
0
PRIVATE HTAssocList * findCookie (HTRequest * request, void * param)
{
    HTAssocList * alist = HTAssocList_new();	/* Is deleted by the cookie module */
    HTAssocList_addObject(alist, "dummy-name", "dummy-value");
    return alist;
}