GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - iwind/gofcgi: golang client for fastcgi

BranchesTags
Open more actions menu

Latest commit

 

History

18 Commits
18 Commits

Folders and files

NameName
Last commit message
Last commit date
pkg/fcgi
pkg/fcgi
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 

Repository files navigation

Description

a golang client for fastcgi, support connection pool and easy to use.

Pool usage

// retrieve shared pool
pool := fcgi.SharedPool("tcp", "127.0.0.1:9000", 16)
client, err := pool.Client()
if err != nil {
    return
}

// create a request
req := fcgi.NewRequest()
params := map[string]string{
	"SCRIPT_FILENAME": "[PATH TO YOUR SCRIPT]/index.php",
	"SERVER_SOFTWARE": "gofcgi/1.0.0",
	"REMOTE_ADDR":     "127.0.0.1",
	"QUERY_STRING":    "NAME=VALUE",

	"SERVER_NAME":       "example.com",
	"SERVER_ADDR":       "127.0.0.1:80",
	"SERVER_PORT":       "80",
	"REQUEST_URI":       "/index.php",
	"DOCUMENT_ROOT":     "[PATH TO YOUR SCRIPT]",
	"GATEWAY_INTERFACE": "CGI/1.1",
	"REDIRECT_STATUS":   "200",
	"HTTP_HOST":         "example.com",

	"REQUEST_METHOD": "POST",                              // for post method
	"CONTENT_TYPE":   "application/x-www-form-urlencoded", // for post
}

req.SetTimeout(5 * time.Second)
req.SetParams(params)

// set request body
r := bytes.NewReader([]byte("name=lu&age=20"))
req.SetBody(r, uint32(r.Len()))

// call request
resp, err := client.Call(req)
if err != nil {
    return
}

// read data from response
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
    return
}
log.Println("resp body:", string(data))

About

golang client for fastcgi

Topics

callclientfastcgifcgigolang

Resources

Readme
MIT license
Activity

Stars

15 stars

Watchers

2 watching

Forks

8 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.