HTTP协议-还没认真读过呢

Network Working Group                                      R. Fielding
Request for Comments: 2616 UC Irvine
Obsoletes: 2068 J. Gettys
Category: Standards Track Compaq/W3C
J. Mogul
Compaq
H. Frystyk
W3C/MIT
L. Masinter
Xerox
P. Leach
Microsoft
T. Berners-Lee
W3C/MIT
June 1999

Hypertext Transfer Protocol -- HTTP/1.1

Status of this Memo

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

Copyright Notice

Copyright (C) The Internet Society (1999). All Rights Reserved.

Abstract

The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers [47]. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.

HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as "HTTP/1.1", and is an update to RFC 2068 [33].

Table of Contents

  1. Introduction ... 1
    1. Purpose ... 1.1
    2. Requirements ... 1.2
    3. Terminology ... 1.3
    4. Overall Operation ... 1.4
  2. Notational Conventions and Generic Grammar ... 2
    1. Augmented BNF ... 2.1
    2. Basic Rules ... 2.2
  3. Protocol Parameters ... 3
    1. HTTP Version ... 3.1
    2. Uniform Resource Identifiers ... 3.2
      1. General Syntax ... 3.2.1
      2. http URL ... 3.2.2
      3. URI Comparison ... 3.2.3
    3. Date/Time Formats ... 3.3
      1. Full Date ... 3.3.1
      2. Delta Seconds ... 3.3.2
    4. Character Sets ... 3.4
      1. Missing Charset ... 3.4.1
    5. Content Codings ... 3.5
    6. Transfer Codings ... 3.6
      1. Chunked Transfer Coding ... 3.6.1
    7. Media Types ... 3.7
      1. Canonicalization and Text Defaults ... 3.7.1
      2. Multipart Types ... 3.7.2
    8. Product Tokens ... 3.8
    9. Quality Values ... 3.9
    10. Language Tags ... 3.10
    11. Entity Tags ... 3.11
    12. Range Units ... 3.12
  4. HTTP Message ... 4
    1. Message Types ... 4.1
    2. Message Headers ... 4.2
    3. Message Body ... 4.3
    4. Message Length ... 4.4
    5. General Header Fields ... 4.5
  5. Request ... 5
    1. Request-Line ... 5.1
      1. Method ... 5.1.1
      2. Request-URI ... 5.1.2
    2. The Resource Identified by a Request ... 5.2
    3. Request Header Fields ... 5.3
  6. Response ... 6
    1. Status-Line ... 6.1
      1. Status Code and Reason Phrase ... 6.1.1
    2. Response Header Fields ... 6.2
  7. Entity ... 7
    1. Entity Header Fields ... 7.1
    2. Entity Body ... 7.2
      1. Type ... 7.2.1
      2. Entity Length ... 7.2.2
  8. Connections ... 8
    1. Persistent Connections ... 8.1
      1. Purpose ... 8.1.1
      2. Overall Operation ... 8.1.2
      3. Proxy Servers ... 8.1.3
      4. Practical Considerations ... 8.1.4
    2. Message Transmission Requirements ... 8.2
      1. Persistent Connections and Flow Control ... 8.2.1
      2. Monitoring Connections for Error Status Messages ... 8.2.2
      3. Use of the 100 (Continue) Status ... 8.2.3
      4. Client Behavior if Server Prematurely Closes Connection ... 8.2.4
  9. Method Definitions ... 9
    1. Safe and Idempotent Methods ... 9.1
      1. Safe Methods ... 9.1.1
      2. Idempotent Methods ... 9.1.2
    2. OPTIONS ... 9.2
    3. GET ... 9.3
    4. HEAD ... 9.4
    5. POST ... 9.5
    6. PUT ... 9.6
    7. DELETE ... 9.7
    8. TRACE ... 9.8
    9. CONNECT ... 9.9
  10. Status Code Definitions ... 10
    1. Informational 1xx ... 10.1
      1. 100 Continue ... 10.1.1
      2. 101 Switching Protocols ... 10.1.2
    2. Successful 2xx ... 10.2
      1. 200 OK ... 10.2.1
      2. 201 Created ... 10.2.2
      3. 202 Accepted ... 10.2.3
      4. 203 Non-Authoritative Information ... 10.2.4
      5. 204 No Content ... 10.2.5
      6. 205 Reset Content ... 10.2.6
      7. 206 Partial Content ... 10.2.7
    3. Redirection 3xx ... 10.3
      1. 300 Multiple Choices ... 10.3.1
      2. 301 Moved Permanently ... 10.3.2
      3. 302 Found ... 10.3.3
      4. 303 See Other ... 10.3.4
      5. 304 Not Modified ... 10.3.5
      6. 305 Use Proxy ... 10.3.6
      7. 306 (Unused) ... 10.3.7
      8. 307 Temporary Redirect ... 10.3.8
    4. Client Error 4xx ... 10.4
      1. 400 Bad Request ... 10.4.1
      2. 401 Unauthorized ... 10.4.2
      3. 402 Payment Required ... 10.4.3
      4. 403 Forbidden ... 10.4.4
      5. 404 Not Found ... 10.4.5
      6. 405 Method Not Allowed ... 10.4.6
      7. 406 Not Acceptable ... 10.4.7
      8. 407 Proxy Authentication Required ... 10.4.8
      9. 408 Request Timeout ... 10.4.9
      10. 409 Conflict ... 10.4.10
      11. 410 Gone ... 10.4.11
      12. 411 Length Required ... 10.4.12
      13. 412 Precondition Failed ... 10.4.13
      14. 413 Request Entity Too Large ... 10.4.14
      15. 414 Request-URI Too Long ... 10.4.15
      16. 415 Unsupported Media Type ... 10.4.16
      17. 416 Requested Range Not Satisfiable ... 10.4.17
      18. 417 Expectation Failed ... 10.4.18
    5. Server Error 5xx ... 10.5
      1. 500 Internal Server Error ... 10.5.1
      2. 501 Not Implemented ... 10.5.2
      3. 502 Bad Gateway ... 10.5.3
      4. 503 Service Unavailable ... 10.5.4
      5. 504 Gateway Timeout ... 10.5.5
      6. 505 HTTP Version Not Supported ... 10.5.6
  11. Access Authentication ... 11
  12. Content Negotiation ... 12
    1. Server-driven Negotiation ... 12.1
    2. Agent-driven Negotiation ... 12.2
    3. Transparent Negotiation ... 12.3
  13. Caching in HTTP ... 13
    1. @@ missing
      1. Cache Correctness ... 13.1.1
      2. Warnings ... 13.1.2
      3. Cache-control Mechanisms ... 13.1.3
      4. Explicit User Agent Warnings ... 13.1.4
      5. Exceptions to the Rules and Warnings ... 13.1.5
      6. Client-controlled Behavior ... 13.1.6
    2. Expiration Model ... 13.2
      1. Server-Specified Expiration ... 13.2.1
      2. Heuristic Expiration ... 13.2.2
      3. Age Calculations ... 13.2.3
      4. Expiration Calculations ... 13.2.4
      5. Disambiguating Expiration Values ... 13.2.5
      6. Disambiguating Multiple Responses ... 13.2.6
    3. Validation Model ... 13.3
      1. Last-Modified Dates ... 13.3.1
      2. Entity Tag Cache Validators ... 13.3.2
      3. Weak and Strong Validators ... 13.3.3
      4. Rules for When to Use Entity Tags and Last-Modified Dates ... 13.3.4
      5. Non-validating Conditionals ... 13.3.5
    4. Response Cacheability ... 13.4
    5. Constructing Responses From Caches ... 13.5
      1. End-to-end and Hop-by-hop Headers ... 13.5.1
      2. Non-modifiable Headers ... 13.5.2
      3. Combining Headers ... 13.5.3
      4. Combining Byte Ranges ... 13.5.4
    6. Caching Negotiated Responses ... 13.6
    7. Shared and Non-Shared Caches ... 13.7
    8. Errors or Incomplete Response Cache Behavior ... 13.8
    9. Side Effects of GET and HEAD ... 13.9
    10. Invalidation After Updates or Deletions ... 13.10
    11. Write-Through Mandatory ... 13.11
    12. Cache Replacement ... 13.12
    13. History Lists ... 13.13
  14. Header Field Definitions ... 14
    1. Accept ... 14.1
    2. Accept-Charset ... 14.2
    3. Accept-Encoding ... 14.3
    4. Accept-Language ... 14.4
    5. Accept-Ranges ... 14.5
    6. Age ... 14.6
    7. Allow ... 14.7
    8. Authorization ... 14.8
    9. Cache-Control ... 14.9
      1. What is Cacheable ... 14.9.1
      2. What May be Stored by Caches ... 14.9.2
      3. Modifications of the Basic Expiration Mechanism ... 14.9.3
      4. Cache Revalidation and Reload Controls ... 14.9.4
      5. No-Transform Directive ... 14.9.5
      6. Cache Control Extensions ... 14.9.6
    10. Connection ... 14.10
    11. Content-Encoding ... 14.11
    12. Content-Language ... 14.12
    13. Content-Length ... 14.13
    14. Content-Location ... 14.14
    15. Content-MD5 ... 14.15
    16. Content-Range ... 14.16
    17. Content-Type ... 14.17
    18. Date ... 14.18
      1. Clockless Origin Server Operation ... 14.18.1
    19. ETag ... 14.19
    20. Expect ... 14.20
    21. Expires ... 14.21
    22. From ... 14.22
    23. Host ... 14.23
    24. If-Match ... 14.24
    25. If-Modified-Since ... 14.25
    26. If-None-Match ... 14.26
    27. If-Range ... 14.27
    28. If-Unmodified-Since ... 14.28
    29. Last-Modified ... 14.29
    30. Location ... 14.30
    31. Max-Forwards ... 14.31
    32. Pragma ... 14.32
    33. Proxy-Authenticate ... 14.33
    34. Proxy-Authorization ... 14.34
    35. Range ... 14.35
      1. Byte Ranges ... 14.35.1
      2. Range Retrieval Requests ... 14.35.2
    36. Referer ... 14.36
    37. Retry-After ... 14.37
    38. Server ... 14.38
    39. TE ... 14.39
    40. Trailer ... 14.40
    41. Transfer-Encoding ... 14.41
    42. Upgrade ... 14.42
    43. User-Agent ... 14.43
    44. Vary ... 14.44
    45. Via ... 14.45
    46. Warning ... 14.46
    47. WWW-Authenticate ... 14.47
  15. Security Considerations ... 15
    1. Personal Information ... 15.1
      1. Abuse of Server Log Information ... 15.1.1
      2. Transfer of Sensitive Information ... 15.1.2
      3. Encoding Sensitive Information in URI's ... 15.1.3
      4. Privacy Issues Connected to Accept Headers ... 15.1.4
    2. Attacks Based On File and Path Names ... 15.2
    3. DNS Spoofing ... 15.3
    4. Location Headers and Spoofing ... 15.4
    5. Content-Disposition Issues ... 15.5
    6. Authentication Credentials and Idle Clients ... 15.6
    7. Proxies and Caching ... 15.7
      1. Denial of Service Attacks on Proxies ... 15.7.1
  16. Acknowledgments ... 16
  17. References ... 17
  18. Authors' Addresses ... 18
  19. Appendices ... 19
    1. Internet Media Type message/http and application/http ... 19.1
    2. Internet Media Type multipart/byteranges ... 19.2
    3. Tolerant Applications ... 19.3
    4. Differences Between HTTP Entities and RFC 2045 Entities ... 19.4
      1. MIME-Version ... 19.4.1
      2. Conversion to Canonical Form ... 19.4.2
      3. Conversion of Date Formats ... 19.4.3
      4. Introduction of Content-Encoding ... 19.4.4
      5. No Content-Transfer-Encoding ... 19.4.5
      6. Introduction of Transfer-Encoding ... 19.4.6
      7. MHTML and Line Length Limitations ... 19.4.7
    5. Additional Features ... 19.5
      1. Content-Disposition ... 19.5.1
    6. Compatibility with Previous Versions ... 19.6
      1. Changes from HTTP/1 ... 19.6.1
      2. Compatibility with HTTP/1 ... 19.6.2
      3. Changes from RFC 2068 ... 19.6.3
  20. Index ... 20
  21. Full Copyright Statement ... 21
derived from HTTP/1.1, Internet RFC 2616, Fielding, et al.
using rfc2html Revision: 1.8 Date: 2004/09/01 13:21:38 by Dan Connolly
### SQL Server 与 MySQL 的区别 SQL Server 和 MySQL 是两种主流的关系型数据库管理系统(RDBMS)。尽管两者都基于标准的 SQL 查询语言,但在多个方面仍存在显著差异。 #### 许可与成本 - **SQL Server**: 主要由 Microsoft 提供支持,提供商业版和免费版(如 Express 版本)。然而,对于企业级应用,通常需要购买许可证,这会增加总体拥有成本[^1]。 - **MySQL**: 开源并被 Oracle 支持,提供了 GPL 协议下的开源版本以及付费的企业版。因此,在许多情况下,MySQL 可以作为低成本甚至零成本的选择[^2]。 #### 性能与可扩展性 - **SQL Server**: 更适合于 Windows 平台的应用程序开发环境,并且在处理复杂查询、事务管理等方面表现出色。它还具有强大的内置工具集来优化性能和监控系统状态[^3]。 - **MySQL**: 被认为更轻量级,尤其擅长高并发读操作场景下保持高效运行能力;同时由于其跨平台特性良好,能够很好地适应 Linux/Unix 系统需求[^4]。 #### 功能与特性 - **SQL Server**: - 集成了 BI 商业智能解决方案; - 提供高级安全机制如 Always Encrypted 技术保护敏感数据传输过程中的隐私; - 支持 CLR(Common Language Runtime),允许开发者编写 .NET Framework 中的语言函数直接嵌入到存储过程中执行业务逻辑[^1]。 - **MySQL**: - 插件架构灵活易定制化插件满足特定用途需求比如全文索引引擎 MyISAM 或 InnoDB 存储引擎选择权交给使用者决定何时启用 ACID 合规模式; - JSON 类型原生支持使得 NoSQL 场景也能轻松应对[^2]。 #### 社区与支持 - **SQL Server**: 得益于微软的强大背景资源投入力度较大,官方文档详尽全面,技术支持响应迅速及时解决疑难杂症问题。 - **MySQL**: 拥有庞大的全球活跃用户群体贡献大量第三方库组件丰富生态系统建设成果斐然,遇到困难时可通过互联网快速找到相应解答方法。 --- ### 是否需要重新学习 MySQL? 如果已经掌握了 SQL Server,则是否还需要专门花时间去深入研究 MySQL 应该取决于以下几个因素: 1. **目标应用场景** 如果未来的工作项目更多倾向于 Web 应用或者云计算领域内的微服务架构设计部署工作当中需要用到关系型数据库的话那么熟悉一下 MySQL 就显得尤为重要因为它是这些环境中非常流行的选项之一[^2]。 2. **技术迁移难度** 对比两者的语法结构可以发现大部分基础概念是相通互换使用的可能性较高只需要注意某些特殊关键字表达方式上的细微差别即可完成平滑过渡例如日期默认值定义语句形式不同等问题可以通过查阅资料加以修正调整[^4]。 3. **职业发展考量** 掌握多种数据库产品有助于拓宽就业机会范围增强竞争力尤其是在当前大数据时代背景下具备多技能组合的人才更加受到市场青睐所以即使目前主要接触的是某一种类型的 RDBMS也建议适当涉猎其他同类竞品以便随时切换角色承担新挑战任务[^1]. 综上所述,考虑到实际工作中可能会面临不同的技术和框架要求,重新学习 MySQL 是有益无害的行为。而且随着 Java 生态圈内 Spring Boot 等现代框架对 MySQL 的高度集成友好程度不断提高,进一步降低了入门门槛。 ```python import mysql.connector def connect_to_mysql(): try: connection = mysql.connector.connect( host='localhost', user='root', password='password', database='testdb' ) if connection.is_connected(): db_info = connection.get_server_info() print(f"Connected to MySQL Server version {db_info}") except Exception as e: print(e) connect_to_mysql() ``` --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值