Skip to content

Commit

Permalink
fixed: allow building with older versions of libmicrohttpd
Browse files Browse the repository at this point in the history
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@27939 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
theuni committed Feb 18, 2010
1 parent a6b40d9 commit 9f633be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
10 changes: 0 additions & 10 deletions README.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ already in the XBMC source code tree.
# make
# sudo make install

On 8.04 and older versions, libmicrohttpd is outdated and thus XBMC will not compile properly.
In this case you will have to manually compile the latest version. Luckly the source is
already in the XBMC source code tree.
# apt-get remove libmicrohttpd-dev
# sudo apt-get install texinfo
# cd lib/libmicrohttpd
# ./configure
# make
# sudo make install

--------------------------------------------------------------
3.2. Use a single command to get all build dependencies
--------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions xbmc/utils/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,17 @@ bool CWebServer::IsAuthenticated (CWebServer *server, struct MHD_Connection *con
return server->m_Credentials64Encoded.Equals(headervalue + strlen(strbase));
}

#if (MHD_VERSION >= 0x00040001)
int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls)
#else
int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
unsigned int *upload_data_size, void **con_cls)
#endif
{
CWebServer *server = (CWebServer *)cls;

Expand Down Expand Up @@ -155,7 +162,11 @@ int CWebServer::AnswerToConnection(void *cls, struct MHD_Connection *connection,
return MHD_NO;
}

#if (MHD_VERSION >= 0x00040001)
int CWebServer::JSONRPC(CWebServer *server, struct MHD_Connection *connection, const char *upload_data, size_t *upload_data_size)
#else
int CWebServer::JSONRPC(CWebServer *server, struct MHD_Connection *connection, const char *upload_data, unsigned int *upload_data_size)
#endif
{
#ifdef HAS_JSONRPC
CStdString jsoncall;
Expand Down
13 changes: 9 additions & 4 deletions xbmc/utils/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@ class CWebServer : public JSONRPC::ITransportLayer
private:
static int AskForAuthentication (struct MHD_Connection *connection);
static bool IsAuthenticated (CWebServer *server, struct MHD_Connection *connection);

#if (MHD_VERSION >= 0x00040001)
static int ContentReaderCallback (void *cls, uint64_t pos, char *buf, int max);
static int JSONRPC(CWebServer *server, struct MHD_Connection *connection, const char *upload_data, size_t *upload_data_size);
static int AnswerToConnection (void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls);

#if (MHD_VERSION >= 0x00040001)
static int ContentReaderCallback (void *cls, uint64_t pos, char *buf, int max);
#else //libmicrohttpd < 0.4.0
static int ContentReaderCallback (void *cls, size_t pos, char *buf, int max);
static int JSONRPC(CWebServer *server, struct MHD_Connection *connection, const char *upload_data, unsigned int *upload_data_size);
static int AnswerToConnection (void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
unsigned int *upload_data_size, void **con_cls);
#endif
static void ContentReaderFreeCallback (void *cls);
static int JSONRPC(CWebServer *server, struct MHD_Connection *connection, const char *upload_data, size_t *upload_data_size);
static int HttpApi(struct MHD_Connection *connection);

static int FillArgumentMap(void *cls, enum MHD_ValueKind kind, const char *key, const char *value);
Expand Down

0 comments on commit 9f633be

Please sign in to comment.