Web Client Programming with Perl-Chapter 3: Learning HTTP- P3
Số trang: 27
Loại file: pdf
Dung lượng: 76.23 KB
Lượt xem: 5
Lượt tải: 0
Xem trước 3 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tham khảo tài liệu web client programming with perl-chapter 3: learning http- p3, công nghệ thông tin, quản trị web phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Web Client Programming with Perl-Chapter 3: Learning HTTP- P3 Chapter 3: Learning HTTP- P3HTTP HeadersNow were ready for the meat of HTTP: the headers that clients and serverscan use to exchange information about the data, or about the software itself.If the Web were just a matter of retrieving documents blindly, then HTTP0.9 would have been sufficient for all our needs. But as it turns out, theres awhole set of information wed like to exchange in addition to the documentsthemselves. A client might ask the server, What kind of document are yousending? Or, I already have an older copy of this document--do I need tobother you for a new one?A server may want to know, Who are you? Or, Who sent you here? Or,How am I supposed to know youre allowed to be here?All this extra (meta-) information is passed between the client and serverusing HTTP headers. The headers are specified immediately after the initialline of the transaction (which is used for the client request or server responseline). Any number of headers can be specified, followed by a blank line andthen the entity-body itself (if any).HTTP makes a distinction between four different types of headers: General headers indicate general information such as the date, or whether the connection should be maintained. They are used by both clients and servers. Request headers are used only for client requests. They convey the clients configuration and desired document format to the server. Response headers are used only in server responses. They describe the servers configuration and special information about the requested URL. Entity headers describe the document format of the data being sent between client and server. Although Entity headers are most commonly used by the server when returning a requested document, they are also used by clients when using the POST or PUT methods.Headers from all three categories may be specified in any order. Headernames are case-insensitive, so the Content-Type header is alsofrequently written as Content-type.In the remainder of this chapter, well list all the headers, and then discussthe ones that are most interesting, in context. Appendix A contains a fulllisting of headers, with examples for each and additional information on itssyntax and purpose when applicable.General HeadersCache-Control Specifies behavior for caching Indicates whether network connection should close afterConnection this connectionDate Specifies the current date Specifies the version of MIME used in the HTTPMIME-Version transactionPragma Specifies directives to a proxy system Indicates what type of transformation has been appliedTransfer-Encoding to the message body for safe transferUpgrade Specifies the preferred communication protocols Used by gateways and proxies to indicate the protocolsVia and hosts that processed the transaction between client and serverRequest HeadersAccept Specifies media formats that the client can accept Tells the server the types of character sets that the clientAccept-Charset can handle Specifies the encoding schemes that the client canAccept-Encoding accept, such as compress or gzip Specifies the language in which the client prefers theAccept-Language dataAuthorization Used to request restricted documentsCookie Used to convey name=value pairs stored for the server Indicates the email address of the user executing theFrom client Specifies the host and port number that the clientHost connected to. This header is required for all clients in HTTP 1.1. Requests the document only if newer than the specifiedIf-Modified-Since date Requests the document only if it matches the givenIf-Match entity tags Requests the document only if it does not match theIf-None-Match given entity tags Requests only the portion of the document that isIf-Range missing, if it has not been changedIf-Unmodified- Requests the document only if it has not been changedSince since the given date Limits the number of proxies or gateways that canMax-Forwards forward the requestProxy- Used to identify client to a proxy requiring authorizationAuthorizationRange Specifies only the specified partial portion of the document Specifies the URL of the document that contained theReferer link to this one (i.e., the previous document)User-Agent Identifies the client programResponse Headers Declares whether or not the server accepts rangeAccept-Ranges requests, and if so, what unitsAge Indicates the age of the document in secondsProxy- Declares the authentication scheme and realm for theAuthenticate proxy Contains a comma-separated list of supported methodsPublic other than those specified in HTTP/1.0 Specifies either the number of seconds or a date afterRetry-After which the server becomes available againServer Specifies the name and version number ...
Nội dung trích xuất từ tài liệu:
Web Client Programming with Perl-Chapter 3: Learning HTTP- P3 Chapter 3: Learning HTTP- P3HTTP HeadersNow were ready for the meat of HTTP: the headers that clients and serverscan use to exchange information about the data, or about the software itself.If the Web were just a matter of retrieving documents blindly, then HTTP0.9 would have been sufficient for all our needs. But as it turns out, theres awhole set of information wed like to exchange in addition to the documentsthemselves. A client might ask the server, What kind of document are yousending? Or, I already have an older copy of this document--do I need tobother you for a new one?A server may want to know, Who are you? Or, Who sent you here? Or,How am I supposed to know youre allowed to be here?All this extra (meta-) information is passed between the client and serverusing HTTP headers. The headers are specified immediately after the initialline of the transaction (which is used for the client request or server responseline). Any number of headers can be specified, followed by a blank line andthen the entity-body itself (if any).HTTP makes a distinction between four different types of headers: General headers indicate general information such as the date, or whether the connection should be maintained. They are used by both clients and servers. Request headers are used only for client requests. They convey the clients configuration and desired document format to the server. Response headers are used only in server responses. They describe the servers configuration and special information about the requested URL. Entity headers describe the document format of the data being sent between client and server. Although Entity headers are most commonly used by the server when returning a requested document, they are also used by clients when using the POST or PUT methods.Headers from all three categories may be specified in any order. Headernames are case-insensitive, so the Content-Type header is alsofrequently written as Content-type.In the remainder of this chapter, well list all the headers, and then discussthe ones that are most interesting, in context. Appendix A contains a fulllisting of headers, with examples for each and additional information on itssyntax and purpose when applicable.General HeadersCache-Control Specifies behavior for caching Indicates whether network connection should close afterConnection this connectionDate Specifies the current date Specifies the version of MIME used in the HTTPMIME-Version transactionPragma Specifies directives to a proxy system Indicates what type of transformation has been appliedTransfer-Encoding to the message body for safe transferUpgrade Specifies the preferred communication protocols Used by gateways and proxies to indicate the protocolsVia and hosts that processed the transaction between client and serverRequest HeadersAccept Specifies media formats that the client can accept Tells the server the types of character sets that the clientAccept-Charset can handle Specifies the encoding schemes that the client canAccept-Encoding accept, such as compress or gzip Specifies the language in which the client prefers theAccept-Language dataAuthorization Used to request restricted documentsCookie Used to convey name=value pairs stored for the server Indicates the email address of the user executing theFrom client Specifies the host and port number that the clientHost connected to. This header is required for all clients in HTTP 1.1. Requests the document only if newer than the specifiedIf-Modified-Since date Requests the document only if it matches the givenIf-Match entity tags Requests the document only if it does not match theIf-None-Match given entity tags Requests only the portion of the document that isIf-Range missing, if it has not been changedIf-Unmodified- Requests the document only if it has not been changedSince since the given date Limits the number of proxies or gateways that canMax-Forwards forward the requestProxy- Used to identify client to a proxy requiring authorizationAuthorizationRange Specifies only the specified partial portion of the document Specifies the URL of the document that contained theReferer link to this one (i.e., the previous document)User-Agent Identifies the client programResponse Headers Declares whether or not the server accepts rangeAccept-Ranges requests, and if so, what unitsAge Indicates the age of the document in secondsProxy- Declares the authentication scheme and realm for theAuthenticate proxy Contains a comma-separated list of supported methodsPublic other than those specified in HTTP/1.0 Specifies either the number of seconds or a date afterRetry-After which the server becomes available againServer Specifies the name and version number ...
Tìm kiếm theo từ khóa liên quan:
thủ thuật máy tính công nghệ thông tin tin học quản trị mạng computer networkTài liệu liên quan:
-
52 trang 432 1 0
-
24 trang 358 1 0
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 319 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 308 0 0 -
74 trang 303 0 0
-
96 trang 297 0 0
-
Báo cáo thực tập thực tế: Nghiên cứu và xây dựng website bằng Wordpress
24 trang 291 0 0 -
Đồ án tốt nghiệp: Xây dựng ứng dụng di động android quản lý khách hàng cắt tóc
81 trang 284 0 0 -
EBay - Internet và câu chuyện thần kỳ: Phần 1
143 trang 277 0 0 -
Tài liệu dạy học môn Tin học trong chương trình đào tạo trình độ cao đẳng
348 trang 269 1 0