mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-10 05:59:45 -05:00
Migrate all evhttp to non-deprecated libevent2
- well except a troublemaker in httpd_daap.c (req->flags &= ~EVHTTP_PROXY_REQUEST)
This commit is contained in:
42
src/evhttp/evhttp_compat.c
Normal file
42
src/evhttp/evhttp_compat.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2010 Julien BLACHE <jb@jblache.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "evhttp_compat.h"
|
||||
|
||||
struct evhttp_connection *
|
||||
evhttp_connection_base_new(struct event_base *base, void *ignore, const char *address, unsigned short port)
|
||||
{
|
||||
struct evhttp_connection *evcon;
|
||||
|
||||
if (!base || !address || !port)
|
||||
return NULL;
|
||||
|
||||
evcon = evhttp_connection_new(address, port);
|
||||
if (evcon)
|
||||
evhttp_connection_set_base(evcon, base);
|
||||
|
||||
return evcon;
|
||||
}
|
||||
|
||||
void
|
||||
evhttp_request_set_header_cb(struct evhttp_request *req, int (*cb)(struct evhttp_request *, void *))
|
||||
{
|
||||
req->header_cb = cb;
|
||||
}
|
||||
|
||||
27
src/evhttp/evhttp_compat.h
Normal file
27
src/evhttp/evhttp_compat.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "evhttp.h"
|
||||
|
||||
/* This file should only be included if using libevent 1
|
||||
*
|
||||
* The following adds libevent 2 evhttp functions to libevent 1, so we avoid
|
||||
* the need of having many HAVE_LIBEVENT2 conditions inside the code
|
||||
*/
|
||||
|
||||
#define evhttp_request_get_response_code(x) x->response_code
|
||||
|
||||
#define evhttp_request_get_input_headers(x) x->input_headers
|
||||
#define evhttp_request_get_output_headers(x) x->output_headers
|
||||
|
||||
#define evhttp_request_get_input_buffer(x) x->input_buffer
|
||||
#define evhttp_request_get_output_buffer(x) x->output_buffer
|
||||
|
||||
#define evhttp_request_get_host(x) x->remote_host
|
||||
|
||||
#define evhttp_request_get_uri evhttp_request_uri
|
||||
|
||||
struct evhttp_connection *
|
||||
evhttp_connection_base_new(struct event_base *base, void *ignore, const char *address, unsigned short port);
|
||||
|
||||
void
|
||||
evhttp_request_set_header_cb(struct evhttp_request *req, int (*cb)(struct evhttp_request *, void *));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user