summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/HttpServ.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc
index 1559efd..5c9a8aa 100644
--- a/lib/HttpServ.cc
+++ b/lib/HttpServ.cc
@@ -8,6 +8,7 @@
#include "ReadJob.h"
#include "CopyJob.h"
#include "Task.h"
+#include "Base64.h"
#include "gettext.h"
String endhl = "\r\n", endnl = "\n";
@@ -35,7 +36,7 @@ class ProcessRequest : public Task {
Action * p;
Socket s;
- String name, host, gvars;
+ String name, host, gvars, login, password;
Variables * Vars, * Heads;
bool bad, hasvars, post;
};
@@ -82,6 +83,18 @@ int ProcessRequest::Do() throw(GeneralException) {
if (t.strstr("Host: ") == 0) {
host = t.extract(6);
}
+ if (t.strstr("Authorization: Basic ") == 0) {
+ char * credentials = (char *) Base64::decode(t.extract(21), 0);
+ char * p = strchr(credentials, ':');
+
+ if (p) {
+ *p = 0;
+ login = credentials;
+ password = p + 1;
+ }
+
+ free(credentials);
+ }
if ((p = t.strchr(':')) >= 0) {
String s = t.extract(0, p - 1);