src/server/webdav/requestparser.h

Sat, 25 Mar 2023 17:18:51 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 25 Mar 2023 17:18:51 +0100
changeset 489
921f83a8943f
parent 415
d938228c382e
permissions
-rw-r--r--

fix PUT could potentially return a wrong status code

/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 2019 Olaf Wintermann. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef REQUESTPARSER_H
#define REQUESTPARSER_H

#include "../public/webdav.h"

#include <libxml/tree.h>
#include <cx/buffer.h>

#ifdef __cplusplus
extern "C" {
#endif
    
#define PROPFIND_PARSER_OK                   0
#define PROPFIND_PARSER_NO_PROPFIND          1
#define PROPFIND_PARSER_NO_PROPERTIES        2
#define PROPFIND_PARSER_INVALID_REQUEST      3
#define PROPFIND_PARSER_OOM                  4
#define PROPFIND_PARSER_ERROR                5
    
#define PROPPATCH_PARSER_OK                  0
#define PROPPATCH_PARSER_NO_PROPERTYUPDATE   1
#define PROPPATCH_PARSER_NO_PROPERTIES       2
#define PROPPATCH_PARSER_INVALID_REQUEST     3
#define PROPPATCH_PARSER_DUPLICATE           4
#define PROPPATCH_PARSER_OOM                 5
#define PROPPATCH_PARSER_ERROR               6

#define LOCK_PARSER_OK                       0
#define LOCK_PARSER_NO_LOCKINFO              1
#define LOCK_PARSER_INVALID_REQUEST          2
#define LOCK_PARSER_UNKNOWN_ELEMENT          3
#define LOCK_PARSER_OOM                      4
#define LOCK_PARSER_ERROR                    5


WebdavProperty* prop_create(
        pool_handle_t *pool,
        WSNamespace *ns,
        const char *name);
    
WebdavPropfindRequest* propfind_parse(
        Session *sn,
        Request *rq,
        const char *buf,
        size_t buflen,
        int *error);

WebdavProppatchRequest* proppatch_parse(
        Session *sn,
        Request *rq,
        const char *buf,
        size_t buflen,
        int *error);

WebdavProppatchRequest* webdav_parse_set(
        Session *sn,
        Request *rq,
        const char *buf,
        size_t buflen,
        const char *rootns,
        const char *rootname,
        WSBool allowremove,
        int *error);

WebdavLockRequest* lock_parse(
        Session *sn,
        Request *rq,
        const char *buf,
        size_t buflen,
        int *error);


#ifdef __cplusplus
}
#endif

#endif /* REQUESTPARSER_H */

mercurial