paivana

HTTP paywall reverse proxy
Log | Files | Refs | README | LICENSE

paivana-httpd_reverse.h (2722B)


      1 /*
      2      This file is part of GNUnet.
      3      Copyright (C) 2026 Taler Systems SA
      4 
      5      Paivana is free software; you can redistribute it and/or
      6      modify it under the terms of the GNU General Public License
      7      as published by the Free Software Foundation; either version
      8      3, or (at your option) any later version.
      9 
     10      Paivana is distributed in the hope that it will be useful,
     11      but WITHOUT ANY WARRANTY; without even the implied warranty
     12      of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
     13      the GNU General Public License for more details.
     14 
     15      You should have received a copy of the GNU General Public
     16      License along with Paivana; see the file COPYING.  If not,
     17      write to the Free Software Foundation, Inc., 51 Franklin
     18      Street, Fifth Floor, Boston, MA 02110-1301, USA.
     19 */
     20 
     21 /**
     22  * @author Christian Grothoff
     23  * @file paivana-httpd_reverse.h
     24  *
     25  * @brief Project data definition
     26  */
     27 #ifndef PAIVANA_HTTPD_REVERSE_H
     28 #define PAIVANA_HTTPD_REVERSE_H
     29 
     30 #include <gnunet/gnunet_util_lib.h>
     31 #include <microhttpd.h>
     32 #include "paivana-httpd.h"
     33 
     34 bool
     35 PAIVANA_HTTPD_reverse_init (void);
     36 
     37 
     38 void
     39 PAIVANA_HTTPD_reverse_shutdown (void);
     40 
     41 
     42 struct HttpRequest *
     43 PAIVANA_HTTPD_reverse_create (struct MHD_Connection *connection,
     44                               const char *url);
     45 
     46 /**
     47  * Main MHD callback for reverse proxy.
     48  *
     49  * @param hr the HTTP request context
     50  * @param con MHD connection handle
     51  * @param url the url in the request
     52  * @param meth the HTTP method used ("GET", "PUT", etc.)
     53  * @param ver the HTTP version string (i.e. "HTTP/1.1")
     54  * @param upload_data the data being uploaded (excluding HEADERS,
     55  *        for a POST that fits into memory and that is encoded
     56  *        with a supported encoding, the POST data will NOT be
     57  *        given in upload_data and is instead available as
     58  *        part of MHD_get_connection_values; very large POST
     59  *        data *will* be made available incrementally in
     60  *        upload_data)
     61  * @param upload_data_size set initially to the size of the
     62  *        @a upload_data provided; the method must update this
     63  *        value to the number of bytes NOT processed;
     64  * @return #MHD_YES if the connection was handled successfully,
     65  *         #MHD_NO if the socket must be closed due to a serious
     66  *         error while handling the request
     67  */
     68 enum MHD_Result
     69 PAIVANA_HTTPD_reverse (struct HttpRequest *hr,
     70                        struct MHD_Connection *con,
     71                        const char *url,
     72                        const char *meth,
     73                        const char *ver,
     74                        const char *upload_data,
     75                        size_t *upload_data_size);
     76 
     77 
     78 void
     79 PAIVANA_HTTPD_reverse_cleanup (struct HttpRequest *hr);
     80 
     81 #endif