Content-Length Missing From HTTP Header Returned From ORDS While Running Non-Apex Application (Doc ID 2125804.1)

Last updated on JUNE 26, 2016

Applies to:

Oracle REST Data Services - Version 3.0.4 and later
Information in this document applies to any platform.

Symptoms

While trying to download the file from the Non-Apex Application using the ORDS (Replacing Modplsql ) the Content-Length parameter is missing when HTTP Headers are enabled.

The issue can be reproduced using the below steps:

- Create a database directory pointing to a local folder on your database server. Call the directory TEMPDIR.
- Put a random file called "testfile.txt" in this directory.
- Create the following procedure in your database:

Procedure TestDownloadFile is
begin
bfilePointer := bfilename('TEMPDIR', 'testfile.txt');
blobLength := dbms_lob.getlength(bfilePointer);

owa_util.mime_header(nvl(blobMimetype, 'application/octet'), false);
htp.p('Content-length: '||blobLength);
htp.p('Content-Disposition: attachment; filename="'||fileRec.filename||'"');
owa_util.http_header_close;
wpg_docload.download_file(bfilePointer);
end;

- Get Firefox and add the Live HTTP Headers here: http://mzl.la/1XkVd8h
- Run the above procedure through the ORDS PL/SQL Gateway, with Firefox. 
- Monitor the HTTP Headers, while you do this, through the Firefox plugin. Notice, that even though the procedure contains the line htp.p('Content-length: '||blobLength);
- The HTTP Header does not contain the Content-Length.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms