sponsored links

Collapse

Announcement

Collapse
No announcement yet.

How to change the return status

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to change the return status

    CGI programs always want to return status 200 for OK. Is there a way to return status 201 or 202?

  • #2
    Answer is: Start the program name with nph_. Most languages require nph-, but for us RPG people, program names can't contain a hyphen, so we use the underscore instead.

    This tells CGI not to auto gen HTTP headers. Then you can send what ever you like as long as you send it in utf-8 format.

    Comment


    • #3
      I must disagree with Flodge... Never start a program with "NPH" this completely changes the way CGI works. It means "no parse headers" and basically means you have to do a lot more of the work yourself, coding all of the headers needed by the HTTP protocol.

      Instead, just send back a status header to control the status code. You are probably already sending a header that says "Content-type: text/html" (or similar). Just add a line before that (must be on a line by itself) that has "Status: 200" or "Status: 404" or whatever you want the status to be.

      You haven't said how you're coding the CGI (which language? Calling the IBM APIs? Writing to the C stdout stream? Using a toolkit like CGIDEV2, eRPGSDK, RPGsp?) I can't comment on the precise code you need... but hopefully the info above is enough to give you the idea.

      Comment


      • #4
        Thanks

        Comment

        sponsored links

        Collapse

        Working...
        X