Highlighted
Honored Contributor.
Honored Contributor.
809 views

CGI Content

[Migrated content. Thread originally posted on 15 December 2011]

Hello,

our Intranet is coded in AcuCobol (CGI).
I will give the Users the Option to Create a Event in Outlook from the Intranet-Calendar i coded.

I think the easiest option is to create a vcs-file. But to realsize this i have to change the
- Content-Type
- Content-Disposition

In the CGI-Manual from Acu i found in "4.6 Creating a Runtime Configuration" that i can Change the Content-Type
-> Problem 1 solved

But what is with the Content-Disposition?

With PHP i will write:
header("Content-Type: text/Calendar");
header("Content-Disposition: inline; filename=calendar.ics");





0 Likes
2 Replies
Highlighted
Visitor.

RE: CGI Content

You can generally produce any custom HTTP header by using DISPLAY ... UPON SYSOUT.
However you must be sure to do this prior to any display of an external form item.

           DISPLAY "Content-Disposition: inline; filename=calendar.ics"
                   UPON SYSOUT.

However, for strict conformance with the protocol (HTTP), you should ensure the line is terminated with CRLF. To force this:

           DISPLAY "Content-Disposition: inline; filename=calendar.ics"
                   UPON SYSOUT, WITH NO ADVANCING
           DISPLAY x"0d0a"
                   UPON SYSOUT, WITH NO ADVANCING


A more complete example:

       77  cgi-header               pic x(1024).
       77  trailing-space-length    pic 9(3) value 0.
       77  usable-length            pic 9(3) value 0.
       78  crlf                     value x"0d0a".



       Main.
           move "Content-Disposition: inline; filename=calendar.ics"
             to cgi-header
           perform display-cgi-header

           ...

       display-cgi-header.
           inspect cgi-header
               tallying trailing-space-length for trailing spaces
           subtract trailing-space-length from length of cgi-header
               giving usable-length
           display cgi-header(1:usable-length)
               upon sysout, with no advancing
           display crlf
               upon sysout, with no advancing
           .


Upon the first display of an external form item, the runtime will produce its own set of cgi headers, then terminate the headers with an extra CRLF, and finally begin to output the actual content. The cgi headers that the runtime automatically generates are Content-type: text/html and Pragma: no-cache. If you want to suppress this and take full control of producing your own headers, you can set the CGI_AUTO_HEADER config variable to 0 (the default value is 1). You would then need to use the above methodology to produce all your own headers, including the extra CRLF after the last one to signal the end of the headers.

(note that CGI_CONTENT_TYPE has no effect when CGI_AUTO_HEADER is set to 0)
0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: CGI Content

thanks, i will test it 🙂
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.