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 FEBRUARY 03, 2022

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 a file from a Non-Apex Application using  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. per example <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/enable  Live HTTP Headers

- Run the above procedure through the ORDS, 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

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
Symptoms
Cause
Solution
References


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