darkmist icon

simple_cgi.go

darkmist | PRO | 12/31/16 05:37:53 PM UTC | 0 ⭐ | 194 👁️ | Never ⏰ | []
Go |

440 B

|

None

|

0 👍

/

0 👎

func errorResponse(code int, msg string) {
    fmt.Printf("Status: %d %s\r\n", code, msg)
    fmt.Printf("Content-Type: text/plain\r\n")
    fmt.Printf("\r\n")
    fmt.Printf("%s\r\n", msg)
}
 
func main() {
    req, err := cgi.Request()
    if err != nil {
        errorResponse(500, "cannot get cgi request" + err.Error())
    }
 
    fmt.Printf("Content-Type: text/plain\r\n")
    fmt.Printf("\r\n")
    fmt.Printf("req=%v\r\n", req)
    fmt.Printf("body=%v\r\n", req.Body)
}

Comments