34int  send_https_header(
int sofd, SSL* ssl, 
tList* pp, 
int mode)
 
   43        sz  = ssl_tcp_send_Buffer(sofd, ssl, &buf);
 
   44        if (mode==
ON) sz = sz - hs;
 
   65int  send_https_Buffer(
int sofd, SSL* ssl, 
tList* pl, 
Buffer* buf)
 
   91    sz  = ssl_tcp_send_Buffer(sofd, ssl, &snd);
 
  112int  send_https_file(
int sofd, SSL* ssl, 
tList* pl, 
const char* fname)
 
  125    if (fname!=NULL) sz = 
file_size((
char*)fname);
 
  132        if (!
strcasecmp((
const char*)(pp->ldat.key.buf), 
"Content-Length")) {
 
  141    if (fname!=NULL && sz!=0) fp = fopen(fname, 
"rb");
 
  143        html = (
unsigned char*)malloc(sz+1);
 
  150        memset(html, 0, sz+1);
 
  151        rs = fread(html, sz, 1, fp); 
 
  158    sz = ssl_tcp_send_Buffer(sofd, ssl, &buf);
 
  189int  recv_https_header(
int sofd, SSL* ssl, 
tList** pl, 
int* len, 
int tm, FILE* fp, 
int* state)
 
  206    cc  = ssl_tcp_recv_Buffer_wait(sofd, ssl, &mbuf, tm);
 
  212                if (fp!=NULL) fwrite(mbuf.
buf, cc, 1, fp);
 
  233            cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &mbuf, tm);
 
  247    if (*pl!=NULL) (*pl)->ldat.id = com;
 
  248    if (state!=NULL) *state = connect;
 
  250    if (sz==0 && cc==0) 
return 0;      
 
  275        if (hbuf.
buf!=NULL) {
 
  276            *len = atoi((
const char*)hbuf.
buf);
 
  311int  recv_https_content(
int sofd, SSL* ssl, 
Buffer* buf, 
int len, 
int tm, FILE* fp, 
int* state)
 
  316    if (state!=NULL) *state = 
TRUE;
 
  318    if (sz>0 && fp!=NULL) fwrite(buf->
buf, sz, 1, fp);
 
  324        cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
 
  326            if (fp!=NULL) fwrite(rcv.
buf, cc, 1, fp);
 
  331            if (state!=NULL) *state = 
FALSE;
 
  360int  recv_https_chunked(
int sofd, SSL* ssl, 
Buffer* buf, 
int tm, FILE* fp, 
int* state)
 
  363    int chnksz, hdsz, tlsz;
 
  364    if (state!=NULL) *state = 
TRUE;
 
  370        cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &tmp, tm);
 
  372            if (state!=NULL) *state = 
FALSE;
 
  387        if (chnksz+hdsz+tlsz > tmp.
vldsz) {
 
  388            cc = recv_https_chunked_remain(sofd, ssl, &tmp, chnksz+hdsz+tlsz, tm);
 
  402        for (i=0; i<tmp.
vldsz-chnksz-hdsz-tlsz; i++) {
 
  403            tmp.
buf[i] = tmp.
buf[chnksz + hdsz + tlsz + i];
 
  409            cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &tmp, tm);
 
  419    if (fp!=NULL) fwrite(buf->
buf, buf->
vldsz, 1, fp);
 
  440int  recv_https_chunked_remain(
int sofd, SSL* ssl, 
Buffer* buf, 
int chnksz, 
int tm)
 
  444    if (chnksz<=sz) 
return 0;
 
  450        cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
 
  481int  recv_https_closed(
int sofd, SSL* ssl, 
Buffer* buf, 
int tm, FILE* fp)
 
  490        cc = ssl_tcp_recv_Buffer_wait(sofd, ssl, &rcv, tm);
 
  492            if (fp!=NULL) fwrite(rcv.
buf, cc, 1, fp);
 
  529int  recv_https_Buffer(
int sofd, SSL* ssl, 
tList** pl, 
Buffer* buf, 
int tsecond, 
int* hdonly, 
int* state, 
int nochunk)
 
  537    if (hdonly!=NULL) *hdonly = 
FALSE;
 
  542    hs = recv_https_header(sofd, ssl, &lp, &len, tsecond, NULL, &connect);
 
  543    if (state!=NULL) *state = connect;
 
  544    if (hs<=0) 
return hs;                                           
 
  546        if (hdonly!=NULL) *hdonly = 
TRUE;
 
  547        if (pl!=NULL) *pl = lp;
 
  569            cc = recv_https_content(sofd, ssl, buf, len, tsecond, NULL, &connect);
 
  574                cc = recv_https_chunked(sofd, ssl, buf, tsecond, NULL, &connect);
 
  578            cc = recv_https_closed(sofd, ssl, buf, tsecond, NULL);
 
  591    if (pl!=NULL) *pl = lp;
 
  594    if (cc>0) cc = cc + hs;
 
  596    if (state!=NULL) *state = connect;
 
  620int  recv_https_file(
int sofd, SSL* ssl, 
tList** pl, 
const char* fname, 
const char* wdir, 
int tsecond, 
int* hdonly, 
int* state)
 
  625    const char tmpd[] = 
"/tmp";
 
  628    if (hdonly!=NULL) *hdonly = 
FALSE;
 
  631    hs = recv_https_header(sofd, ssl, pl, &len, tsecond, NULL, &connect);
 
  632    if (state!=NULL) *state = connect;
 
  633    if (hs<=0) 
return hs;                                           
 
  635        if (hdonly!=NULL) *hdonly = 
TRUE;
 
  664            cc = recv_https_content(sofd, ssl, &buf, len, tsecond, NULL, &connect);
 
  667            cc = recv_https_chunked(sofd, ssl, &buf, tsecond, NULL, &connect);
 
  671            cc = recv_https_closed(sofd, ssl, &buf, tsecond, NULL);
 
  678        if (fname!=NULL) fp = fopen(fname, 
"wb");
 
  695                        DEBUG_MODE PRINT_MESG(
"RECV_HTTPS_FILE: WARNING: Content-Encoding is [%s]. But zlib is not installed!!\n", buf.
buf);
 
  697                        if (wdir==NULL) wdir = tmpd;
 
  731    if (state!=NULL) *state = connect;
 
  755int   save_https_xml(
int cofd, SSL* ssl, 
tList** pl, 
tXML** xml, 
char** recvfn, 
const char* wdir, 
int timeout, 
int* state)
 
  759    if (pl==NULL || recvfn==NULL) 
return 0;
 
  762    if (xml!=NULL) *xml = NULL;
 
  765    int cc = recv_https_file(cofd, ssl, pl, *recvfn, wdir, timeout, &header, state);
 
  766    if (cc<=0 || *pl==NULL) {
 
  779        if (xml!=NULL && *pl!=NULL && *recvfn!=NULL && cc>0) {
 
  782            if (*xml!=NULL && (*xml)->state<0) 
del_all_xml(xml);
 
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
 
int cat_b2Buffer(void *src, Buffer *dst, int len)
任意のバイナリデータsrcを Buffer型変数dstへ lenバイト catする.
 
void clear_Buffer(Buffer *str)
Buffer型変数 のバッファ部を 0クリアする.
 
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
 
int cat_Buffer(Buffer *src, Buffer *dst)
Buffer変数 srcから dstへバッファを catする.
 
int copy_Buffer(Buffer *src, Buffer *dst)
Buffer型変数 srcから dstへバッファをコピーする.
 
#define copy_s2Buffer(src, dst)
copy_b2Buffer()
 
#define make_Buffer_str(str)
set_Buffer()
 
#define WORK_FILENAME_LEN
 
#define JBXL_ARGS_ERROR
不正な引数(NULLなど)
 
#define JBXL_SSL_RECV_ERROR
SSL 受信エラー
 
#define JBXL_MALLOC_ERROR
メモリ確保エラー
 
#define JBXL_NET_RECV_TIMEOUT
受信タイムアウト
 
int recv_wait(int sock, int tm)
 
Buffer search_protocol_header(tList *list, char *key, int no)
 
Buffer restore_protocol_header(tList *list, char *deli, int mode, int *hdsz)
 
tList * get_protocol_header_list_seq(tList *lp, Buffer buf, char deli, int fstline, int rcntnt)
 
#define delete_protocol_header(p, k, n)
 
#define HDLIST_CONTENTS_KEY
 
#define add_protocol_header(p, k, v)
 
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
 
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
 
tList * del_tList(tList **pp)
指定したリストノード以降のリストを削除.
 
tList * strncasecmp_tList(tList *pl, const char *key, int len, int no)
char* 型変数によるノードのサーチ.大文字小文字を無視する
 
tList * find_tList_top(tList *pl)
リストの最初のノードを探す.
 
#define add_tList_node_Buffer(p, k, v)
add_tList_node_byBuffer()
 
tXML * xml_parse_file(const char *fn)
ファイルから読み込んでパースする.
 
#define del_all_xml(p)
XMLツリーの全ノードの削除.ポインタ ppのノードを含むXMLツリー全体を削除する.