mirror of
https://github.com/znc/znc.git
synced 2026-08-08 01:43:03 +02:00
Merge pull request #485 from uu1101/uriprefix
Allow serving the web interface under a subpath Fix #480 Fix #138
This commit is contained in:
@@ -25,8 +25,8 @@ class CModule;
|
||||
|
||||
class CHTTPSock : public CSocket {
|
||||
public:
|
||||
CHTTPSock(CModule *pMod);
|
||||
CHTTPSock(CModule *pMod, const CString& sHostname, unsigned short uPort, int iTimeout = 60);
|
||||
CHTTPSock(CModule *pMod, const CString& sURIPrefix);
|
||||
CHTTPSock(CModule *pMod, const CString& sURIPrefix, const CString& sHostname, unsigned short uPort, int iTimeout = 60);
|
||||
virtual ~CHTTPSock();
|
||||
|
||||
// Csocket derived members
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
const CString& GetPass() const;
|
||||
const CString& GetParamString() const;
|
||||
const CString& GetContentType() const;
|
||||
const CString& GetURIPrefix() const;
|
||||
bool IsPost() const;
|
||||
// !Getters
|
||||
|
||||
@@ -121,6 +122,7 @@ protected:
|
||||
bool m_bAcceptGzip;
|
||||
MCString m_msRequestCookies;
|
||||
MCString m_msResponseCookies;
|
||||
CString m_sURIPrefix;
|
||||
};
|
||||
|
||||
#endif // !_HTTPSOCK_H
|
||||
|
||||
@@ -32,11 +32,12 @@ public:
|
||||
ACCEPT_ALL
|
||||
} EAcceptType;
|
||||
|
||||
CListener(unsigned short uPort, const CString& sBindHost, bool bSSL, EAddrType eAddr, EAcceptType eAccept) {
|
||||
CListener(unsigned short uPort, const CString& sBindHost, const CString& sURIPrefix, bool bSSL, EAddrType eAddr, EAcceptType eAccept) {
|
||||
m_uPort = uPort;
|
||||
m_sBindHost = sBindHost;
|
||||
m_bSSL = bSSL;
|
||||
m_eAddr = eAddr;
|
||||
m_sURIPrefix = sURIPrefix;
|
||||
m_pListener = NULL;
|
||||
m_eAcceptType = eAccept;
|
||||
}
|
||||
@@ -49,6 +50,7 @@ public:
|
||||
unsigned short GetPort() const { return m_uPort; }
|
||||
const CString& GetBindHost() const { return m_sBindHost; }
|
||||
CRealListener* GetRealListener() const { return m_pListener; }
|
||||
const CString& GetURIPrefix() const { return m_sURIPrefix; }
|
||||
EAcceptType GetAcceptType() const { return m_eAcceptType; }
|
||||
// !Getters
|
||||
|
||||
@@ -65,13 +67,14 @@ protected:
|
||||
EAddrType m_eAddr;
|
||||
unsigned short m_uPort;
|
||||
CString m_sBindHost;
|
||||
CString m_sURIPrefix;
|
||||
CRealListener* m_pListener;
|
||||
EAcceptType m_eAcceptType;
|
||||
};
|
||||
|
||||
class CRealListener : public CZNCSock {
|
||||
public:
|
||||
CRealListener(CListener *pParent) : CZNCSock(), m_pParent(pParent) {}
|
||||
CRealListener(CListener& listener) : CZNCSock(), m_Listener(listener) {}
|
||||
virtual ~CRealListener();
|
||||
|
||||
virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort);
|
||||
@@ -79,18 +82,19 @@ public:
|
||||
virtual void SockError(int iErrno, const CString& sDescription);
|
||||
|
||||
private:
|
||||
CListener* m_pParent;
|
||||
CListener& m_Listener;
|
||||
};
|
||||
|
||||
class CIncomingConnection : public CZNCSock {
|
||||
public:
|
||||
CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::EAcceptType eAcceptType);
|
||||
CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::EAcceptType eAcceptType, const CString& sURIPrefix);
|
||||
virtual ~CIncomingConnection() {}
|
||||
virtual void ReadLine(const CString& sData);
|
||||
virtual void ReachedMaxBuffer();
|
||||
|
||||
private:
|
||||
CListener::EAcceptType m_eAcceptType;
|
||||
const CString m_sURIPrefix;
|
||||
};
|
||||
|
||||
#endif // !_LISTENER_H
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
PAGE_DONE // all stuff has been done
|
||||
};
|
||||
|
||||
CWebSock();
|
||||
CWebSock(const CString& sURIPrefix);
|
||||
virtual ~CWebSock();
|
||||
|
||||
virtual bool ForceLogin();
|
||||
|
||||
@@ -478,6 +478,17 @@ public:
|
||||
*/
|
||||
CString TrimSuffix_n(const CString& sSuffix) const;
|
||||
|
||||
/** Check whether the string starts with a given prefix.
|
||||
* @param sPrefix The prefix.
|
||||
* @return True if the string starts with prefix, false otherwise.
|
||||
*/
|
||||
bool StartsWith(const CString& sPrefix) const;
|
||||
/** Check whether the string ends with a given suffix.
|
||||
* @param sSuffix The suffix.
|
||||
* @return True if the string ends with suffix, false otherwise.
|
||||
*/
|
||||
bool EndsWith(const CString& sSuffix) const;
|
||||
|
||||
/** Remove characters from the beginning of this string.
|
||||
* @param uLen The number of characters to remove.
|
||||
* @return true if this string was modified.
|
||||
|
||||
+2
-1
@@ -154,7 +154,8 @@ public:
|
||||
// Listener yummy
|
||||
CListener* FindListener(u_short uPort, const CString& BindHost, EAddrType eAddr);
|
||||
bool AddListener(CListener*);
|
||||
bool AddListener(unsigned short uPort, const CString& sBindHost, bool bSSL,
|
||||
bool AddListener(unsigned short uPort, const CString& sBindHost,
|
||||
const CString& sURIPrefix, bool bSSL,
|
||||
EAddrType eAddr, CListener::EAcceptType eAccept, CString& sError);
|
||||
bool DelListener(CListener*);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user