Grabbing HTTP Header

Dan Shafer dan at eclecticity.com
Tue May 6 02:47:01 EDT 2003


Thanks, Monte.

I got your post on the Rev list. The engine is in the right place and referenced correctly. A simple CGI that doesn't involve parsing the incoming headers but just puts up a message works just fine.

I have set the permissions on the script to 755, so that is right as well.

I just can't make the very script that you present below run on my system and I'm completely befuddled as to why. One of the problems is I can't figure out where on OSX there might be a log I can check to see more precisely what's going wrong here.

Arrggggh.

>
>Hi Dan
>
>I'm not sure if you go my post on the Rev list about this. One thing that
>you need to remember is to make sure the first line points to the engine. If
>the engine is named mc and it's in the same folder as the cgi then the first
>line is: #!mc otherwise it's #!<path to mc><engine name>. It's beter to work
>out the full path then you can put CGIs anywhere and you don't need to
>change it.
>
>I've posted the version of echo.cgi that I use for your reference:
>
>#!mc
># This MetaTalk script loops over all the environment variables
># set by the server when it runs a CGI application printing out
># its name and value.
>on startup
>  # loop over all of the global variables, getting name and value
>  repeat for each item i in the globals
>   put i && "=" && value(i)& return after buffer
>  end repeat
>  # write minimal set of HTTP headers to stdout
>  read from stdin until empty
>  put it after buffer
>  replace cr with "<P>" in buffer
>  put "Content-Type: text/plain" & cr
>  put "Content-Length:" && the length of buffer & cr & cr
>  put buffer
>end startup
>
>The other thing is to make sure the file has permissions of 755 so it can
>execute.
>
>Regards
>
>Monte
>>
>>
>> This script does not run on my configuration. It gives me the
>> same useless internal server error all other CGIs that don't work give me.
>>
>> I am really stumped here. I hope someone can lead me out of the
>> wilderness.
>>
>> >I though the echo.mt cgi has it?
>> >
>> >#!/home/mc/mc
>> ># This MetaTalk script loops over all the environment variables
>> ># set by the server when it runs a CGI application printing out
>> ># its name and value.
>> >on startup
>> ># loop over all of the global variables, getting name and value
>> >  repeat for each item i in the globals
>> >   put i && "=" && value(i) & return after buffer
>> >  end repeat
>> >
>> >  put "" into tContainer
>> >  if $CONTENT_LENGTH > 0 then
>> >    put $CONTENT_LENGTH into tLen
>> >    put "" into tContainer
>> >    put 0 into tContainerSize
>> >    repeat
>> >      read from stdin until empty
>> >      put it after tContainer
>> >      add length(it) to tContainerSize
>> >      if tContainerSize >= tLen then
>> >        exit repeat
>> >      end if
>> >    end repeat
>> >  end if
>> >
>> >  #!
>> >  put "Content-Type: text/plain" & cr
>> >  put "Content-Length:" && the length of (buffer & tContainer) & cr & cr
>> >  put buffer & tContainer
>> >end startup
>> >
>> >--
>> >
>> >
>> >_______________________________________________
>> >metacard mailing list
>> >metacard at lists.runrev.com
>> >http://lists.runrev.com/mailman/listinfo/metacard
>> _______________________________________________
>> metacard mailing list
>> metacard at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/metacard
>>
>
>_______________________________________________
>metacard mailing list
>metacard at lists.runrev.com
>http://lists.runrev.com/mailman/listinfo/metacard



More information about the metacard mailing list