亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? httpdav.c

?? 站點映像程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*    sitecopy, for managing remote web sites. WebDAV client routines.   Copyright (C) 1998-99, Joe Orton <joe@orton.demon.co.uk>                                                                        This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.     This program 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 General Public License for more details.     You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   $Id: httpdav.c,v 1.46.2.18 1999/08/27 10:03:49 joe Exp $*//* This file is a collection of routines to implement a basic WebDAV * client, including an HTTP/1.1 client.  * Transparently supports basic and digest authentication. *//* HTTP method implementation: *   Call, in this order: *     1.  http_request_init()  - set up the request *     2.  http_request()       - make the request *     3.  http_request_end()   - clean up the request */#include <config.h>#include <sys/types.h>#include <sys/stat.h>#ifdef __EMX__#include <sys/select.h>#endif#include <netinet/in.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <stdio.h>#ifdef HAVE_STRING_H#include <string.h>#endif#ifdef HAVE_STRINGS_H#include <strings.h>#endif #ifdef HAVE_STDLIB_H#include <stdlib.h>#endif /* HAVE_STDLIB_H */#ifdef HAVE_UNISTD_H#include <unistd.h>#endif /* HAVE_UNISTD_H */#ifndef HAVE_SNPRINTF#include <snprintf.h>#endif#include <dates.h>#include <basename.h>#include <dirname.h>#include <strsplit.h>#include "frontend.h"#include "protocol.h"#include "httpauth.h"#include "httpdav.h"#include "common.h"#include "socket.h"#include "base64.h"/* Connection information... */int http_sock;bool http_connected;bool http_disable_expect = false;/* Time in seconds to wait for the server to give us a 100 Continue * after submitting a PUT with an "Expect: 100-continue" header. */#define HTTP_EXPECT_TIMEOUT 15/* 100-continue only used if size > HTTP_EXPECT_MINSIZ */#define HTTP_EXPECT_MINSIZE 512/* Whether the current server respects the Expect: 100-continue header */int http_expect_works; /* == 0 if it we don't know, 1 if it does,			    -1 if it doesn't support 100-continue */bool http_webdav_server = false;bool http_init_checks = true;bool http_conn_limit = false;/* Warning given out on spoof attack */const char *http_warn_spoof =   "The server has switched to using basic authentication from digest\n"  "authenticaion, which may be an attempt to discover your password.\n"  "Basic auth will NOT be used.";bool http_can_authenticate;http_auth_session_t http_server_auth, http_proxy_auth;unsigned int http_version_major, http_version_minor;const char *http_quotes = "\"'";const char *http_whitespace = " \r\n\t";#ifdef HAVE_LIBEXPAT/* WebDAV Fetch mode */#include <xmlparse.h>typedef enum {    dav_xml_multistatus = 0,    dav_xml_response,    dav_xml_responsedescription,    dav_xml_href,    dav_xml_propstat,    dav_xml_prop,    dav_xml_status,    dav_xml_getlastmodified,    dav_xml_getcontentlength,    dav_xml_resourcetype,    dav_xml_collection,    dav_xml_unknown,    dav_xml_root} dav_xml_tag_t;/* We get the tag_t from the names array below */const char *dav_xml_tagnames[] = {    "DAV:multistatus",    "DAV:response",    "DAV:responsedescription",    "DAV:href",    "DAV:propstat",    "DAV:prop",    "DAV:status",    "DAV:getlastmodified",    "DAV:getcontentlength",    "DAV:resourcetype",    "DAV:collection",    NULL, /* end-of-list marker */    "@<root>@" /* filler, so we can index this by dav_xml_tag_t */};typedef struct dav_xml_ns_s dav_xml_ns;/* Linked list of namespace scopes */struct dav_xml_ns_s {    char *name;    char *value;    dav_xml_ns *next;};struct dav_xml_state {    dav_xml_tag_t tag;    char *tag_name; /* The full tag name */    char *default_ns; /* The current default namespace */    dav_xml_ns *nspaces; /* List of other namespace scopes */    struct dav_xml_state *parent; /* The parent in the tree */};/* We pass around a dav_xmldoc as the userdata using expat.  This * maintains the current state of the parse and various other bits and * bobs. Within the parse, we store the current branch of the tree, * i.e., the current element and all its parents, but nothing other * than that.  * * The files list is filled as we go (by dav_fetch_gotresource), but * always kept in sorted order, since no ordering of resources in the * PROPFIND response is given.  */struct dav_xmldoc {    /* Points to the root of the document */    struct dav_xml_state *root;    /* Points to the current element in the document */    struct dav_xml_state *current;    /* Whether we want to collect CDATA at the moment or not */    bool want_cdata;    /* The cdata we've collected so far - grows as we collect     * more. */    char *cdata;    /* How big the buffer is atm */    size_t cdata_buflen;    /* How much cdata we've collected so far */    size_t cdata_len;     /* Is it valid? */    bool valid;    /* Temporary store of file info */    struct proto_file_t *file;    /* The complete fetch list */    struct proto_file_t *files;    /* The collection we did a PROPFIND on */    const char *fetch_root;};/* The initial size of the cdata buffer, and the minimum size by which * it grows each time we overflow it. For the PROPFIND requests * we do for sitecopy, the only cdata segments we collect are very small. */#define CDATABUFSIZ 128/* If the cdata buffer size is larger than this when we've finished * with its contents, then we reallocate it. Otherwise, we just * zero it out. Reallocation -> a free() and a malloc(). No realloc ->  * just a memset(). */#define CDATASHRINK 128/* Prototypes */static void dav_xml_startelm( void *userdata, const char *tag, const char **atts );static void dav_xml_endelm( void *userdata, const char *tag );static void dav_xml_cdata( void *userdata, const char *cdata, int len );static bool dav_xml_parsetag( struct dav_xml_state *state,		       const char *tag, const char **atts );static int dav_fetch_getdepth( const char *href );static bool dav_fetch_parse_href( struct dav_xmldoc *doc );static void dav_fetch_gotresource( struct dav_xmldoc *doc );static void dav_xml_parsebody( void *userdata, const char *buffer, const size_t len );static void http_get_content_charset( const char *name, const char *value );char *http_content_charset;#endif /* HAVE_LIBEXPAT *//* Handy macro to free things. */#define DOFREE(x) if( x!=NULL ) free( x )#define EOL "\r\n"#define HTTP_PORT 80const char *http_useragent = PACKAGE "/" VERSION;/* We need to remember the remote host and port even after connecting * the socket e.g. so we can form the Destination: header */struct proto_host_t http_server_host, http_proxy_host;/* This, to store the address of the server we CONNECT to - i.e., * the proxy if we have one, else the server */struct in_addr http_remoteaddr;int http_remoteport;bool http_use_proxy; /* whether we are using the proxy or not */int http_mkdir_works;static int http_response_read( http_req_t *req, char *buffer, size_t buflen );/* Sets up the body size for the given request */static int http_req_bodysize( http_req_t *req );/* The callback for GET requests (to allow signalling progress to the FE) */static void http_get_callback( void *user, const char *buffer, const size_t len );/* Do a dummy MKDIR with PUT */static int http_mkdir_with_put( const char *realdir );/* Holds the error message to be passed up */char http_error[BUFSIZ];/* Put the fixed headers into the request */static void http_req_fixedheaders( http_req_t *req );/* Concatenates the remote server name with :port if port!=80 on to  * the end of str. */static void http_strcat_hostname( struct proto_host_t *host, char *str );/* Header parser for OPTIONS requests. */static void http_options_parsehdr( const char *name, const char *value );static int http_parse_status( http_req_t *req, char *status_line );/* Sends the body down the wire */static int http_req_sendbody( http_req_t *req );/* Encodes the absPath sectionf of a URI using %<hex><hex> encoding */static char *uri_abspath_encode( const char *abs_path );/* Decodes a URI */static char *uri_decode( const char *uri );/* Opens the connection to the remote server. * Returns: *  PROTO_OK       on success *  PROTO_CONNECT  if the socket couldn't be connected */static int http_open( void );/* Closes the connection. * Always returns PROTO_OK */static int http_close( void );/* This doesn't really connect to the server. * Returns *  PROTO_LOOKUP if the hostname of the server could not be resolved *  PROTO_LOCALHOST if the hostname of the local machine could not be *    found *  PROTO_CONNECT if the socket could not be connected *  PROTO_OK if the connection was made successfully. */int http_init( const char *remote_root,	       struct proto_host_t *server, struct proto_host_t *proxy ) {    int ret;    /* Take a copy of the server information */    memcpy( &http_server_host, server, sizeof(struct proto_host_t) );    fe_connection( fe_namelookup );    if( proxy != NULL ) {	memcpy( &http_proxy_host, proxy, sizeof(struct proto_host_t) );	http_remoteport = proxy->port;	http_use_proxy = true;	if( host_lookup( http_proxy_host.hostname, &http_remoteaddr ) )	    return PROTO_LOOKUP;    } else {	http_remoteport = server->port;	http_use_proxy = false;	if( host_lookup( http_server_host.hostname, &http_remoteaddr ) )	    return PROTO_LOOKUP;    }    http_connected = false;    http_expect_works = http_disable_expect?-1:0; /* we don't know yet */    /* temporary workaround */    http_expect_works = -1;    http_mkdir_works = 0; /* we don't know yet */    http_auth_init( &http_server_auth, server->username, server->password );    if( http_use_proxy ) {	/* TODO: Implement properly *//*	http_auth_init( &http_proxy_auth, proxy->username, proxy->password ); */    }    http_can_authenticate = false;    ret = http_open();    /* Drop out if that failed, or they don't want the OPTIONS */    if( (!http_init_checks) || (ret != PROTO_OK) )	return ret;    /* Capability discovery... we don't care whether this     * actually works or not, we just want http_webdav_server     * set appropriately. */    (void) http_options( remote_root );    return PROTO_OK;}int http_finish( void ) {    DEBUG( DEBUG_HTTP, "http_finish called.\n" );    http_auth_finish( &http_server_auth );    if( http_connected ) http_close( );    return PROTO_OK;}/* Parse the HTTP-Version and Status-Code segments of the * given status_line. Sets http_version_* and req->class,status. * Returns: PROTO_OK on success, PROTO_ERROR otherwise */int http_parse_status( http_req_t *req, char *status_line ) {    char *part;    DEBUG( DEBUG_HTTP, "HTTP response line: %s", status_line );    /* Save the line for error codes later */    memset( http_error, 0, BUFSIZ );    strncpy( http_error, status_line, BUFSIZ );    /* Strip off the CRLF for the status line */    if( (part = strchr( http_error, '\r' )) != NULL )	*part = '\0';    /* Check they're speaking the right language */    if( strncmp( status_line, "HTTP/", 5 ) != 0 )	return PROTO_ERROR;    /* And find out which dialect of this peculiar language     * they can talk... */    http_version_major = 0;    http_version_minor = 0;     /* Note, we're good children, and accept leading zero's on the     * version numbers */    for( part = status_line + 5; *part != '\0' && isdigit(*part); part++ ) {	http_version_major += http_version_major*10 + (*part-'0');    }    if( *part != '.' ) return PROTO_ERROR;    for( part++ ; *part != '\0' && isdigit(*part); part++ ) {	http_version_minor += http_version_minor*10 + (*part-'0');    }    DEBUG( DEBUG_HTTP, "HTTP Version Major: %d, Minor: %d\n", 	   http_version_major, http_version_minor );    if( *part != ' ' ) return PROTO_ERROR;    /* Now for the Status-Code. part now points at the space     * between "HTTP/x.x YYY". We want YYY... could use atoi, but     * probably quicker this way. */    req->status = 100*(part[1]-'0') + 10*(part[2]-'0') + (part[3]-'0');    req->class = part[1]-'0';    /* And we can ignore the Reason-Phrase */    DEBUG( DEBUG_HTTP, "HTTP status code: %d\n", req->status );    return PROTO_OK;}/* Sends the body down the socket. * Returns PROTO_OK on success, PROTO_ERROR otherwise */int http_req_sendbody( http_req_t *req ) {    int ret;    switch( req->body ) {    case http_body_file:	ret = transfer( fileno(req->body_file), http_sock, req->body_size );	DEBUG( DEBUG_HTTP, "Sent %d bytes.\n", ret );	rewind( req->body_file ); /* since we may have to send it again */	break;    case http_body_buffer:	DEBUG( DEBUG_HTTP, "Sending body:\n%s\n", req->body_buffer );	ret = send_string( http_sock, req->body_buffer );	break;    default:	DEBUG( DEBUG_HTTP, "Argh in http_req_sendbody!" );	ret = -1;    }    if( ret == -1 ) { 	/* transfer failed */	return PROTO_ERROR;    } else {	return PROTO_OK;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产精品专区| 午夜国产精品影院在线观看| 国产一区二区日韩精品| 欧美日韩国产高清一区二区三区| 亚洲狠狠爱一区二区三区| 在线观看中文字幕不卡| 亚洲一区二区欧美日韩| 在线观看欧美黄色| 亚洲妇女屁股眼交7| 欧美一区二区福利在线| 精品亚洲欧美一区| 国产欧美一区二区三区沐欲| 99久久99久久久精品齐齐| 亚洲一级二级在线| 7777精品伊人久久久大香线蕉完整版 | 国产精品久久二区二区| 91丨porny丨国产入口| 亚洲高清免费视频| 日韩欧美一区二区在线视频| 国产suv精品一区二区6| 又紧又大又爽精品一区二区| 91精品国产综合久久国产大片| 韩国三级中文字幕hd久久精品| 国产精品欧美久久久久一区二区| 91高清视频在线| 久久精品视频一区二区三区| 樱桃国产成人精品视频| 国产一区二区三区免费播放 | 国产精品1024久久| 成人一区二区三区在线观看| 欧美视频中文一区二区三区在线观看| 久久精品夜色噜噜亚洲aⅴ| 狠狠网亚洲精品| 午夜免费久久看| 精品一区二区三区日韩| 国产99久久久国产精品免费看| 欧美综合亚洲图片综合区| 久久精品综合网| 成人激情免费电影网址| 国产乱码一区二区三区| 亚洲午夜在线观看视频在线| 精品国产乱码91久久久久久网站| 成人app网站| 蜜臀av国产精品久久久久| 国产成人福利片| www一区二区| 麻豆精品在线播放| 欧美精品乱码久久久久久按摩| 亚洲在线观看免费| 欧美日韩国产一区二区三区地区| 日韩美女啊v在线免费观看| 日韩av高清在线观看| 欧美日韩国产中文| 精品久久久久久久久久久久包黑料| 成人午夜在线视频| 黄色日韩三级电影| 亚洲福利视频一区| 国产精品国产精品国产专区不蜜| 日韩精品一区二区三区中文精品| 色偷偷一区二区三区| 国产 日韩 欧美大片| 国内精品免费**视频| 日韩精品视频网站| 亚洲国产综合在线| 亚洲永久精品国产| 亚洲欧美日韩国产综合在线| 欧美国产日韩一二三区| 久久精品亚洲精品国产欧美kt∨| 日韩一区二区不卡| 在线不卡中文字幕| 欧美日韩精品一区二区三区四区| 欧美最猛性xxxxx直播| 色呦呦一区二区三区| 91视频在线看| 色综合天天综合网天天狠天天 | 欧美日韩激情一区二区三区| 在线免费一区三区| 99久久99久久综合| 成人精品国产福利| 紧缚奴在线一区二区三区| 午夜欧美在线一二页| 日韩福利视频导航| 亚洲电影一区二区三区| 国产精品传媒入口麻豆| 欧美激情一区二区三区全黄| 欧美tk—视频vk| 日韩精品中文字幕一区二区三区 | 午夜精品一区二区三区免费视频| 国产精品成人午夜| 国产精品美女久久久久高潮| 久久亚洲二区三区| 久久亚洲春色中文字幕久久久| 欧美一区二区视频观看视频| 国产精品亚洲午夜一区二区三区| 国产精品亚洲а∨天堂免在线| 激情文学综合网| 狠狠色丁香婷婷综合久久片| 麻豆精品一二三| 免费成人美女在线观看.| 日本三级韩国三级欧美三级| 免费看欧美女人艹b| 国产一区二区三区美女| 粉嫩av一区二区三区在线播放| 国产高清精品网站| 成人一区二区三区视频在线观看 | 久久丝袜美腿综合| 欧美r级电影在线观看| 欧美v日韩v国产v| 日韩精品一区二区三区swag | 亚洲永久精品国产| 婷婷一区二区三区| 麻豆国产一区二区| 国产精品影视在线| 成人av在线电影| 99久久综合精品| 欧美这里有精品| 91精品综合久久久久久| 精品久久久久久亚洲综合网| 欧美日韩高清在线| 国产午夜三级一区二区三| 国产精品白丝在线| 亚洲午夜久久久久久久久久久| 热久久免费视频| 国产成人鲁色资源国产91色综| 成人av资源在线观看| 在线观看视频一区二区| 精品久久五月天| 国产精品国产精品国产专区不片| 亚洲午夜激情av| 国产乱码精品1区2区3区| 成人午夜av电影| 欧美日韩不卡在线| 久久精品亚洲乱码伦伦中文 | 成人午夜精品一区二区三区| 欧美日韩三级一区二区| 久久综合九色综合久久久精品综合 | 中文字幕一区二区三区色视频| 亚洲一线二线三线视频| 久久99这里只有精品| 91视频在线观看| 精品国产免费一区二区三区四区| 国产精品毛片久久久久久久| 天天影视涩香欲综合网| 国产成人亚洲综合色影视| 在线观看国产日韩| 久久久精品国产免费观看同学| 亚洲一卡二卡三卡四卡| 成人一区二区视频| 欧美一区二区三区在线视频| 亚洲精品一二三| 久久99日本精品| 色视频一区二区| 国产免费成人在线视频| 蜜桃视频在线观看一区二区| 色欧美乱欧美15图片| 久久精品夜夜夜夜久久| 日本人妖一区二区| 91尤物视频在线观看| 中文一区二区在线观看| 久久不见久久见中文字幕免费| 一本久久a久久精品亚洲| 国产女人aaa级久久久级| 精品在线免费视频| 777色狠狠一区二区三区| 亚洲大型综合色站| 一本久道中文字幕精品亚洲嫩| 欧美国产97人人爽人人喊| 久久福利资源站| 日韩欧美综合在线| 亚洲第一成人在线| 欧美一级欧美一级在线播放| 亚洲福利电影网| 色香色香欲天天天影视综合网| 国产欧美精品国产国产专区 | 国产在线精品一区二区不卡了| 色综合天天综合色综合av| 依依成人综合视频| www.日韩av| 国产精品久久久久久久久免费丝袜 | 青青青伊人色综合久久| 欧美人妇做爰xxxⅹ性高电影| 亚洲人成7777| 91在线看国产| 中文字幕亚洲电影| 91亚洲精品久久久蜜桃| 亚洲免费av高清| 欧美日韩国产免费一区二区| 亚洲国产美女搞黄色| 欧美三级中文字| 肉丝袜脚交视频一区二区| 欧美精品第1页| 美女www一区二区| 91精品国产一区二区三区香蕉 | 91精品国产福利在线观看| 一区二区三区鲁丝不卡| 99久久99久久综合| 亚洲制服丝袜一区| 色一情一伦一子一伦一区| 一区2区3区在线看| 欧美精品第1页|