package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "http://www.baidu.com/", nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept-Encoding", "gzip,deflate,sdch")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
fmt.Println(resp.Header.Get("Content-Encoding")) //ȷʵ��gzip--
}
��Transport.DisableCompression�Ľ��ͣ�Ӧ �û��Զ�ungzip�ģ�������ʵ���������ѹ�������ݡ�
--
����: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina
---
���յ����ʼ�����Ϊ������ Google ������̳�ġ�Golang-China����̳��
Ҫ�˶�����̳��ֹͣ���մ���̳�ĵ����ʼ����뷢�͵����ʼ��� golang-china...@googlegroups.com��
Ҫ�������ϲ鿴�����ۣ������ https://groups.google.com /d/msgid/golang-china/587bd187-1049-49c3-ba04- c67a91ea377f%40googlegroups.com��
Ҫ�鿴���ѡ������ https://groups.google.com /groups/opt_out��