package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io"
"net/http"
"os"
"strings"
randomString "github.com/delphinus/random-string"
"golang.org/x/net/context"
)
type httpClientKey struct{}
var HTTPClientKey httpClientKey
func ContextWithClient(parent context.Context, client *http.Client) context.Context {
return context.WithValue(parent, HTTPClientKey, client)
}
func clientFromContext(ctx context.Context) *http.Client {
if client, ok := ctx.Value(HTTPClientKey).(*http.Client); ok {
return client
}
return http.DefaultClient
}
type DigestRequest struct {
context.Context
client *http.Client
username, password string
nonceCount nonceCount
}
type nonceCount int
func (nc nonceCount) String() string {
c := int(nc)
return fmt.Sprintf("%08x", c)
}
const authorization = "Authorization"
const contentType = &#
Go Http请求海康摄像头拍照图片
于 2024-07-05 17:02:35 首次发布