My Oracle Support Banner

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.


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
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||'"');

- Get Firefox and add the Live HTTP Headers here:
- 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.


To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.