mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
Web: HttpClient now supports PUT
git-svn-id: svn://ultimatepp.org/upp/trunk@3861 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f21042bac4
commit
6074559762
5 changed files with 16 additions and 4 deletions
|
|
@ -707,6 +707,8 @@ RichEdit::RichEdit()
|
|||
singleline = false;
|
||||
|
||||
clipzoom = Zoom(1, 1);
|
||||
|
||||
bullet_indent = 150;
|
||||
}
|
||||
|
||||
RichEdit::~RichEdit() {}
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ void RichEdit::SetBullet(int bullet)
|
|||
}
|
||||
else {
|
||||
formatinfo.bullet = bullet;
|
||||
formatinfo.indent = 150;
|
||||
formatinfo.indent = bullet_indent;
|
||||
}
|
||||
ApplyFormat(0, RichText::INDENT|RichText::BULLET);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,8 @@ private:
|
|||
|
||||
Vector<int> ffs;
|
||||
|
||||
int bullet_indent;
|
||||
|
||||
|
||||
|
||||
static int fh[];
|
||||
|
|
@ -758,6 +760,7 @@ public:
|
|||
RichEdit& ClipZoom(Zoom z) { clipzoom = z; return *this; }
|
||||
RichEdit& ClipZoom(int m, int d) { clipzoom = Zoom(m, d); return *this; }
|
||||
Zoom GetClipZoom() const { return clipzoom; }
|
||||
RichEdit& BulletIndent(int i) { bullet_indent = i; return *this; }
|
||||
|
||||
struct UndoInfo {
|
||||
int undoserial;
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ String HttpClient::CalculateDigest(String authenticate) const
|
|||
String hv1, hv2;
|
||||
hv1 << username << ':' << realm << ':' << password;
|
||||
String ha1 = MD5String(hv1);
|
||||
hv2 << (method == METHOD_GET ? "GET" : method == METHOD_POST ? "POST" : "READ")
|
||||
hv2 << (method == METHOD_GET ? "GET" : method == METHOD_PUT ? "PUT" : method == METHOD_POST ? "POST" : "READ")
|
||||
<< ':' << path;
|
||||
String ha2 = MD5String(hv2);
|
||||
int nc = 1;
|
||||
|
|
@ -235,7 +235,12 @@ String HttpClient::Execute(Gate2<int, int> progress)
|
|||
if(IsNull(ctype))
|
||||
ctype = "application/x-www-form-urlencoded";
|
||||
break;
|
||||
case METHOD_HEAD: request << "HEAD "; break;
|
||||
case PUT:
|
||||
request << "PUT ";
|
||||
if(IsNull(ctype))
|
||||
ctype = "application/x-www-form-urlencoded";
|
||||
break;
|
||||
case METHOD_HEAD: request << "HEAD "; break;
|
||||
default: NEVER(); // invalid method
|
||||
}
|
||||
String host_port = host;
|
||||
|
|
@ -258,7 +263,7 @@ String HttpClient::Execute(Gate2<int, int> progress)
|
|||
request << "Accept: " << Nvl(accept, "*/*") << "\r\n";
|
||||
request << "Accept-Encoding: gzip\r\n";
|
||||
request << "Agent: " << Nvl(agent, "Ultimate++ HTTP client") << "\r\n";
|
||||
if(method == METHOD_POST)
|
||||
if(method == METHOD_POST || method == METHOD_PUT)
|
||||
request << "Content-Length: " << postdata.GetLength() << "\r\n";
|
||||
if(ctype.GetCount())
|
||||
request << "Content-Type: " << ctype << "\r\n";
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
HttpClient& Get() { return Method(METHOD_GET); }
|
||||
HttpClient& Post() { return Method(METHOD_POST); }
|
||||
HttpClient& Head() { return Method(METHOD_HEAD); }
|
||||
HttpClient& Put() { return Method(METHOD_PUT); }
|
||||
|
||||
HttpClient& PostData(String pd) { postdata = pd; return *this; }
|
||||
HttpClient& PostUData(String pd) { return PostData(UrlEncode(pd)); }
|
||||
|
|
@ -127,6 +128,7 @@ public:
|
|||
METHOD_GET,
|
||||
METHOD_POST,
|
||||
METHOD_HEAD,
|
||||
METHOD_PUT,
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue