mirror of
				https://github.com/owntone/owntone-server.git
				synced 2025-10-30 00:05:05 -04:00 
			
		
		
		
	[httpd] Fix evhttp_connection_get_peer() const char warning for newer libevent
This commit is contained in:
		
							parent
							
								
									b70188f4b8
								
							
						
					
					
						commit
						017e09d7c3
					
				
							
								
								
									
										10
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								configure.ac
									
									
									
									
									
								
							| @ -156,6 +156,16 @@ OWNTONE_MODULES_CHECK([OWNTONE], [LIBEVENT], [libevent >= 2], | ||||
| 			[Define to 1 if you have libevent 2 (<2.1.4)])]) | ||||
| 	]) | ||||
| 
 | ||||
| dnl Check for evhttp_connection_get_peer() signature | ||||
| AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||||
| 	#include <event2/http.h> | ||||
| 	void evhttp_connection_get_peer(struct evhttp_connection *, const char **, ev_uint16_t *); | ||||
| 	]], [[ ]] | ||||
| 	)], | ||||
| 	[AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR], 1, | ||||
| 		[Define to 1 if evhttp_connection_get_peer expects const char**])] | ||||
| 	) | ||||
| 
 | ||||
| OWNTONE_MODULES_CHECK([OWNTONE], [JSON_C], [json-c], | ||||
| 	[json_tokener_parse], [json.h], | ||||
| 	[dnl check for old version | ||||
|  | ||||
| @ -1006,7 +1006,11 @@ httpd_request_parse(struct evhttp_request *req, struct httpd_uri_parsed *uri_par | ||||
| 
 | ||||
|       evcon = evhttp_request_get_connection(req); | ||||
|       if (evcon) | ||||
| #ifdef HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR | ||||
| 	evhttp_connection_get_peer(evcon, &hreq->peer_address, &hreq->peer_port); | ||||
| #else | ||||
| 	evhttp_connection_get_peer(evcon, (char **)&hreq->peer_address, &hreq->peer_port); | ||||
| #endif | ||||
|       else | ||||
| 	DPRINTF(E_LOG, L_HTTPD, "Connection to client lost or missing\n"); | ||||
| 
 | ||||
|  | ||||
| @ -52,7 +52,7 @@ struct httpd_request { | ||||
|   // http request struct (if available)
 | ||||
|   struct evhttp_request *req; | ||||
|   // Source IP address (ipv4 or ipv6) and port of the request (if available)
 | ||||
|   char *peer_address; | ||||
|   const char *peer_address; | ||||
|   unsigned short peer_port; | ||||
|   // A pointer to extra data that the module handling the request might need
 | ||||
|   void *extra_data; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user