mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: Inet gzip header in reply support, Zlib fixed to support zero length
git-svn-id: svn://ultimatepp.org/upp/trunk@6687 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c3c64208d7
commit
1209bc5fd9
4 changed files with 13 additions and 5 deletions
|
|
@ -520,4 +520,4 @@ public:
|
|||
|
||||
bool HttpResponse(TcpSocket& socket, bool scgi, int code, const char *phrase,
|
||||
const char *content_type = NULL, const String& data = Null,
|
||||
const char *server = NULL);
|
||||
const char *server = NULL, bool gzip = false);
|
||||
|
|
|
|||
|
|
@ -459,7 +459,8 @@ bool HttpHeader::Response(String& protocol, int& code, String& reason) const
|
|||
}
|
||||
|
||||
bool HttpResponse(TcpSocket& socket, bool scgi, int code, const char *phrase,
|
||||
const char *content_type, const String& data, const char *server)
|
||||
const char *content_type, const String& data, const char *server,
|
||||
bool gzip)
|
||||
{
|
||||
String r;
|
||||
r << (scgi ? "Status: " : "HTTP/1.1 ") << code << ' ' << phrase << "\r\n"
|
||||
|
|
@ -470,6 +471,8 @@ bool HttpResponse(TcpSocket& socket, bool scgi, int code, const char *phrase,
|
|||
r << "Content-Length: " << data.GetCount() << "\r\n";
|
||||
if(content_type)
|
||||
r << "Content-Type: " << content_type << "\r\n";
|
||||
if(gzip)
|
||||
r << "Content-Encoding: gzip\r\n";
|
||||
r << "\r\n";
|
||||
if(!socket.PutAll(r))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -71,12 +71,13 @@ r]_`*[*@3 s])&]
|
|||
< 31 as html entities and escapes character 31 as `"` `".&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:HttpResponse`(TcpSocket`&`,bool`,int`,const char`*`,const char`*`,const String`&`,const char`*`): [@(0.0.255) b
|
||||
[s5;:HttpResponse`(TcpSocket`&`,bool`,int`,const char`*`,const char`*`,const String`&`,const char`*`,bool`): [@(0.0.255) b
|
||||
ool]_[* HttpResponse]([_^TcpSocket^ TcpSocket][@(0.0.255) `&]_[*@3 socket],
|
||||
[@(0.0.255) bool]_[*@3 scgi], [@(0.0.255) int]_[*@3 code], [@(0.0.255) const]_[@(0.0.255) cha
|
||||
r]_`*[*@3 phrase], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 content`_type]_`=_NULL,
|
||||
[@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 data]_`=_Null,
|
||||
[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 server]_`=_NULL)&]
|
||||
[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 server]_`=_NULL, [@(0.0.255) bool]_[*@3 gzip]_`=
|
||||
_[@(0.0.255) false])&]
|
||||
[s2;%% This function sends simple HTTP response over [%-*@3 socket].
|
||||
If [%-*@3 scgi] is true, first line of response is formatted for
|
||||
SCGI (rest is the same for normal HTTP and SCGI). [%-*@3 code]
|
||||
|
|
@ -85,7 +86,9 @@ sets the respective http header (if NULL, it is not send). If
|
|||
[%-*@3 data] is not empty, `"content`-length`" header is sent and
|
||||
[%-*@3 data] is sent after the header. [%-*@3 server] sets the `"server`"
|
||||
field of http header, if not present, it is set to `"U`+`+ based
|
||||
server`".&]
|
||||
server`". If [%-*@3 gzip] is true, function adds `"content`-encoding:
|
||||
gzip`" header, but does NOT actually zip the content (that is
|
||||
up to caller).&]
|
||||
[s3; &]
|
||||
[s0; &]
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 HttpHeader]]}}&]
|
||||
|
|
|
|||
|
|
@ -270,6 +270,8 @@ void Zlib::Init()
|
|||
mode = NONE;
|
||||
gzip = false;
|
||||
error = false;
|
||||
z.next_in = (byte*)"";
|
||||
z.avail_in = 0;
|
||||
}
|
||||
|
||||
void Zlib::Clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue