summaryrefslogtreecommitdiff
path: root/libs/networking/include/HTTPRequest.h
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-13 04:26:40 +0200
committergeronimo <geronimo013@gmx.de>2012-07-13 04:26:40 +0200
commit2d48ae784ea6828e8626c32c848f64232d8f35c0 (patch)
treefab114b03e91125783a778b835dd1913b039cebe /libs/networking/include/HTTPRequest.h
downloadcmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.gz
cmp-2d48ae784ea6828e8626c32c848f64232d8f35c0.tar.bz2
initial import
Diffstat (limited to 'libs/networking/include/HTTPRequest.h')
-rw-r--r--libs/networking/include/HTTPRequest.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/libs/networking/include/HTTPRequest.h b/libs/networking/include/HTTPRequest.h
new file mode 100644
index 0000000..87c78d7
--- /dev/null
+++ b/libs/networking/include/HTTPRequest.h
@@ -0,0 +1,62 @@
+/**
+ * ======================== legal notice ======================
+ *
+ * File: HTTPRequest.h
+ * Created: 3. Juli 2012, 17:54
+ * Author: <a href="mailto:geronimo013@gmx.de">Geronimo</a>
+ * Project: libnetworking: classes for tcp/ip sockets and http-protocol handling
+ *
+ * CMP - compound media player
+ *
+ * is a client/server mediaplayer intended to play any media from any workstation
+ * without the need to export or mount shares. cmps is an easy to use backend
+ * with a (ready to use) HTML-interface. Additionally the backend supports
+ * authentication via HTTP-digest authorization.
+ * cmpc is a client with vdr-like osd-menues.
+ *
+ * Copyright (c) 2012 Reinhard Mantey, some rights reserved!
+ * published under Creative Commons by-sa
+ * For details see http://creativecommons.org/licenses/by-sa/3.0/
+ *
+ * The cmp project's homepage is at http://projects.vdr-developer.org/projects/cmp
+ *
+ * --------------------------------------------------------------
+ */
+#ifndef HTTPREQUEST_H
+#define HTTPREQUEST_H
+
+#include <HTTPMessage.h>
+#include <Url.h>
+
+class cHTTPResponse;
+class cHTTPRequest : public cHTTPMessage {
+///< a message sent from client to server to access a certain resource
+public:
+ typedef enum { INVALID, GET, POST } HTTPRequestMethod;
+ cHTTPRequest(const char *MessageBuf);
+ cHTTPRequest(HTTPRequestMethod Format, const char *Url);
+ cHTTPRequest(const cHTTPResponse &res, const char *Url);
+ virtual ~cHTTPRequest();
+ HTTPRequestMethod Method(void) const { return method; }
+ const cUrl &Url() const { return url; }
+ cUrl &Url() { return url; }
+ const char *UserAgent() const;
+ const char *ClientHost(void) const;
+ void SetUser(const char *UserID, const char *Password);
+
+protected:
+ void SetMethod(HTTPRequestMethod Method) { method = Method; }
+ void SetURL(const char *Url);
+ virtual size_t WriteFirstLine(char *Buffer, size_t BufSize);
+ void ParseMessage(const char *MessageBuf);
+
+private:
+ HTTPRequestMethod method;
+ cUrl url;
+ friend class HTTPParser;
+ };
+
+extern const char *requestMethod2String(cHTTPRequest::HTTPRequestMethod Method);
+
+#endif /* HTTPREQUEST_H */
+