資源簡介
libghttp windows下移植,采用vs2010封裝成庫。帶測試說明,帶源碼+庫封裝。

代碼片段和文件信息
/*
?*?ghttp.c?--?Implementation?of?the?public?interface?to?http?functions
?*?Created:?Christopher?Blizzard??21-Aug-1998
?*
?*?Copyright?(C)?1998?Free?Software?Foundation
?*
?*?This?library?is?free?software;?you?can?redistribute?it?and/or
?*?modify?it?under?the?terms?of?the?GNU?Library?General?Public
?*?License?as?published?by?the?Free?Software?Foundation;?either
?*?version?2?of?the?License?or?(at?your?option)?any?later?version.
?*
?*?This?library?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the?GNU
?*?Library?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?Library?General?Public
?*?License?along?with?this?library;?if?not?write?to?the?Free
?*?Software?Foundation?Inc.?675?Mass?Ave?Cambridge?MA?02139?USA.
?*/
#include?
#include?
#ifdef?WIN32
#else
#include?
#endif
#include?“ghttp.h“
#include?“http_uri.h“
#include?“http_hdrs.h“
#include?“http_trans.h“
#include?“http_req.h“
#include?“http_resp.h“
#include?“http_date.h“
#include?“http_global.h“
#include?“http_base64.h“
struct?_ghttp_request
{
??http_uri???????????*uri;
??http_uri???????????*proxy;
??http_req???????????*req;
??http_resp??????????*resp;
??http_trans_conn????*conn;?
??const?char?????????*errstr;
??int?????????????????connected;
??ghttp_proc??????????proc;
??char???????????????*username;
??char???????????????*password;
??char???????????????*authtoken;
??char???????????????*proxy_username;
??char???????????????*proxy_password;
??char???????????????*proxy_authtoken;
};
static?const?char?*basic_header?=?“Basic?“;
ghttp_request?*
ghttp_request_new(void)
{
??struct?_ghttp_request?*l_return?=?NULL;
??/*?create?everything?*/
??l_return?=?malloc(sizeof(struct?_ghttp_request));
??memset(l_return?0?sizeof(struct?_ghttp_request));
??l_return->uri?=?http_uri_new();
??l_return->proxy?=?http_uri_new();
??l_return->req?=?http_req_new();
??l_return->resp?=?http_resp_new();
??l_return->conn?=?http_trans_conn_new();
??return?l_return;
}
void
ghttp_request_destroy(ghttp_request?*a_request)
{
??if?(!a_request)
????return;
??/*?make?sure?that?the?socket?was?shut?down.?*/
??if?(a_request->conn->sock?>=?0)
????{
??????close(a_request->conn->sock);
??????a_request->conn->sock?=?-1;
????}
??/*?destroy?everything?else?*/
??if?(a_request->uri)
????http_uri_destroy(a_request->uri);
??if?(a_request->proxy)
????http_uri_destroy(a_request->proxy);
??if?(a_request->req)
????http_req_destroy(a_request->req);
??if?(a_request->resp)
????http_resp_destroy(a_request->resp);
??if?(a_request->conn)
????http_trans_conn_destroy(a_request->conn);
??/*?destroy?username?info.?*/
??if?(a_request->username)
????{
??????free(a_request->username);
??????a_request->username?=?NULL;
????}
??if?(a_request->password)
????{
??????free(a_request->password);
??????a_request->password?=?NULL;
????}
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????18444??2001-01-06?06:04??libghttp-1.0.9\aclocal.m4
?????文件????????275??1999-05-05?21:25??libghttp-1.0.9\AUTHORS
?????文件??????31101??2001-01-23?08:32??libghttp-1.0.9\ChangeLog
?????文件??????33085??2001-01-06?06:04??libghttp-1.0.9\config.guess
?????文件??????25243??2001-01-06?06:04??libghttp-1.0.9\config.sub
?????文件??????71809??2001-01-06?06:04??libghttp-1.0.9\configure
?????文件???????1060??2000-12-06?03:49??libghttp-1.0.9\configure.in
?????文件??????17992??1999-12-12?22:40??libghttp-1.0.9\COPYING
?????文件??????25265??1998-09-28?22:33??libghttp-1.0.9\COPYING.LIB
?????文件???????7539??1999-08-26?21:05??libghttp-1.0.9\doc\ghttp.html
?????文件??????19668??2016-12-10?19:25??libghttp-1.0.9\ghttp.c
?????文件???????6126??2016-12-10?19:43??libghttp-1.0.9\ghttp.h
?????文件????????204??2000-06-11?06:57??libghttp-1.0.9\ghttpConf.sh.in
?????文件???????3492??1999-08-19?07:27??libghttp-1.0.9\ghttp_constants.h
?????文件???????2792??1998-12-10?04:26??libghttp-1.0.9\http_ba
?????文件???????1031??1998-11-21?00:37??libghttp-1.0.9\http_ba
?????文件???????8601??2000-10-31?09:28??libghttp-1.0.9\http_date.c
?????文件???????1053??1998-09-28?22:33??libghttp-1.0.9\http_date.h
?????文件???????1217??1998-09-28?22:34??libghttp-1.0.9\http_global.h
?????文件??????10096??2016-12-10?19:33??libghttp-1.0.9\http_hdrs.c
?????文件???????2240??2000-12-06?03:49??libghttp-1.0.9\http_hdrs.h
?????文件???????6540??2000-12-06?03:49??libghttp-1.0.9\http_req.c
?????文件???????2180??1999-08-21?04:48??libghttp-1.0.9\http_req.h
?????文件??????20683??2016-12-10?19:33??libghttp-1.0.9\http_resp.c
?????文件???????2518??2001-01-23?08:32??libghttp-1.0.9\http_resp.h
?????文件???????8988??2016-12-10?19:26??libghttp-1.0.9\http_trans.c
?????文件???????2995??2016-12-10?19:07??libghttp-1.0.9\http_trans.h
?????文件???????5678??2000-10-31?09:28??libghttp-1.0.9\http_uri.c
?????文件???????1494??1999-03-03?11:11??libghttp-1.0.9\http_uri.h
?????文件???????7831??1999-12-12?22:40??libghttp-1.0.9\INSTALL
............此處省略72個文件信息
評論
共有 條評論