DataRequest, FileRequest: send HeadersReceived notification

The "header" in this case is just the MIME type and content size, but we
must still send the notification when these are available. It will be
used for example in WebKit next release.
This commit is contained in:
Adrien Destugues
2015-02-06 15:19:38 +01:00
parent a2adc97219
commit ff75005a7a
2 changed files with 10 additions and 5 deletions
@@ -86,6 +86,7 @@ BDataRequest::_ProtocolLoop()
if (charset.Length() > 0) if (charset.Length() > 0)
mimeType << ";" << charset; mimeType << ";" << charset;
fResult.SetContentType(mimeType); fResult.SetContentType(mimeType);
} }
if (isBase64) { if (isBase64) {
@@ -117,6 +118,7 @@ BDataRequest::_ProtocolLoop()
fResult.SetLength(length); fResult.SetLength(length);
if (fListener != NULL) { if (fListener != NULL) {
fListener->HeadersReceived(this);
fListener->DownloadProgress(this, length, length); fListener->DownloadProgress(this, length, length);
if (length > 0) if (length > 0)
fListener->DataReceived(this, payload, 0, length); fListener->DataReceived(this, payload, 0, length);
@@ -77,6 +77,8 @@ BFileRequest::_ProtocolLoop()
return error; return error;
fResult.SetLength(size); fResult.SetLength(size);
fListener->HeadersReceived(this);
ssize_t chunkSize; ssize_t chunkSize;
char chunk[4096]; char chunk[4096];
while ((chunkSize = file.Read(chunk, sizeof(chunk))) > 0) { while ((chunkSize = file.Read(chunk, sizeof(chunk))) > 0) {
@@ -111,6 +113,7 @@ BFileRequest::_ProtocolLoop()
if (fListener != NULL) { if (fListener != NULL) {
fListener->ConnectionOpened(this); fListener->ConnectionOpened(this);
fListener->HeadersReceived(this);
// Add a parent directory entry. // Add a parent directory entry.
fListener->DataReceived(this, "+/,\t..\r\n", transferredSize, 8); fListener->DataReceived(this, "+/,\t..\r\n", transferredSize, 8);