zoukankan      html  css  js  c++  java
  • URL格式

    scheme://host:port/path

    scheme表示使用什么协议;

    host表示主机标识

    path表示文件所在路径与文件本身是什么。

    If the given URL is missing a scheme name (such as "http://" or "ftp://" etc) then libcurl will make a guess based on the host. If the outermost sub-domain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that protocol will be used, otherwise HTTP will be used. Since 7.45.0 guessing can be disabled by setting a default protocol.

    The host part of the URL contains the address of the server that you want to connect to. This can be the fully qualified domain name of the server, the local network name of the machine on your network or the IP address of the server or machine represented by either an IPv4 or IPv6 address. For example:

    http://www.example.com/

    http://hostname/

    http://192.168.0.1/

    http://[2001:1890:1112:1::20]/

    It is also possible to specify the user name, password and any supported login options as part of the host, for the following protocols, when connecting to servers that require authentication:

    http://user:password@www.example.com

    ftp://user:password@ftp.example.com

    smb://domain%2fuser:password@server.example.com

    imap://user:password;options@mail.example.com

    pop3://user:password;options@mail.example.com

    smtp://user:password;options@mail.example.com

    At present only IMAP, POP3 and SMTP support login options as part of the host. For more information about the login options in URL syntax please see RFC 2384, RFC 5092 and IETF draft draft-earhart-url-smtp-00.txt (Added in 7.31.0).

    The port is optional and when not specified libcurl will use the default port based on the determined or specified protocol: 80 for HTTP, 21 for FTP and 25 for SMTP, etc. The following examples show how to specify the port:

    http://www.example.com:8080/ - This will connect to a web server using port 8080 rather than 80.

    smtp://mail.example.com:587/ - This will connect to a SMTP server on the alternative mail port.

    The path part of the URL is protocol specific and whilst some examples are given below this list is not conclusive:

    HTTP

    The path part of an HTTP request specifies the file to retrieve and from what directory. If the directory is not specified then the web server's root directory is used. If the file is omitted then the default document will be retrieved for either the directory specified or the root directory. The exact resource returned for each URL is entirely dependent on the server's configuration.

    http://www.example.com - This gets the main page from the web server.

    http://www.example.com/index.html - This returns the main page by explicitly requesting it.

    http://www.example.com/contactus/ - This returns the default document from the contactus directory.

    想要详细了解请访问下面网站:

    https://curl.haxx.se/libcurl/c/CURLOPT_URL.html

  • 相关阅读:
    网页轮播图案例
    表单
    表格标签的使用
    HTML5标签2
    HTML标签
    外边距
    h5css产品模块设计
    mouseenter 和mouseover的区别
    动画函数封装
    jQuery 插件
  • 原文地址:https://www.cnblogs.com/liuzhenbo/p/11042213.html
Copyright © 2011-2022 走看看