Skip to main content

CGI Content

  • December 16, 2011
  • 2 replies
  • 0 views

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





2 replies

  • Author
  • Rocketeer
  • 19312 replies
  • December 16, 2011

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





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)

  • Author
  • Rocketeer
  • 19312 replies
  • December 16, 2011

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





thanks, i will test it :)