mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
fixed compilation on ubuntu using microhttpd 0.4.6
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8048 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ad1bc7f3b8
commit
ef5d591098
@ -10,6 +10,42 @@
|
|||||||
|
|
||||||
#include "api/JsonStream.h"
|
#include "api/JsonStream.h"
|
||||||
|
|
||||||
|
#ifndef MHD_CONTENT_READER_END_OF_STREAM
|
||||||
|
#define MHD_CONTENT_READER_END_OF_STREAM ((size_t) -1LL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MHD_create_response_from_fd
|
||||||
|
/**
|
||||||
|
* Create a response object. The response object can be extended with
|
||||||
|
* header information and then be used any number of times.
|
||||||
|
*
|
||||||
|
* @param size size of the data portion of the response
|
||||||
|
* @param fd file descriptor referring to a file on disk with the
|
||||||
|
* data; will be closed when response is destroyed;
|
||||||
|
* fd should be in 'blocking' mode
|
||||||
|
* @param offset offset to start reading from in the file;
|
||||||
|
* Be careful! `off_t` may have been compiled to be a
|
||||||
|
* 64-bit variable for MHD, in which case your application
|
||||||
|
* also has to be compiled using the same options! Read
|
||||||
|
* the MHD manual for more details.
|
||||||
|
* @return NULL on error (i.e. invalid arguments, out of memory)
|
||||||
|
* @ingroup response
|
||||||
|
*/
|
||||||
|
struct MHD_Response * MHD_create_response_from_fd(size_t size, int fd)
|
||||||
|
{
|
||||||
|
unsigned char *buf = (unsigned char *)malloc(size) ;
|
||||||
|
|
||||||
|
if(read(fd,buf,size) != size)
|
||||||
|
{
|
||||||
|
std::cerr << "READ error in file descriptor " << fd << std::endl;
|
||||||
|
free(buf) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return MHD_create_response_from_data(size, buf,0,1) ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace resource_api{
|
namespace resource_api{
|
||||||
|
|
||||||
const char* API_ENTRY_PATH = "/api/v2";
|
const char* API_ENTRY_PATH = "/api/v2";
|
||||||
@ -169,7 +205,7 @@ public:
|
|||||||
return MHD_YES;
|
return MHD_YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t contentReadercallback(void *cls, uint64_t pos, char *buf, size_t max)
|
static int contentReadercallback(void *cls, uint64_t pos, char *buf, int max)
|
||||||
{
|
{
|
||||||
MHDFilestreamerHandler* handler = (MHDFilestreamerHandler*)cls;
|
MHDFilestreamerHandler* handler = (MHDFilestreamerHandler*)cls;
|
||||||
if(pos >= handler->mSize)
|
if(pos >= handler->mSize)
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <microhttpd.h>
|
#include <microhttpd.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ void generatePasswordHash() ;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WEBUI
|
#ifdef ENABLE_WEBUI
|
||||||
|
#include <stdarg.h>
|
||||||
#include "api/ApiServerMHD.h"
|
#include "api/ApiServerMHD.h"
|
||||||
#include "api/RsControlModule.h"
|
#include "api/RsControlModule.h"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user