⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http::headers.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.IX Item "$h->remove_content_headers"This will remove all the header fields used to describe the content ofa message.  All header field names prefixed with \f(CW\*(C`Content\-\*(C'\fR fallsinto this category, as well as \f(CW\*(C`Allow\*(C'\fR, \f(CW\*(C`Expires\*(C'\fR and\&\f(CW\*(C`Last\-Modified\*(C'\fR.  \s-1RFC\s0 2616 denote these fields as \fIEntity HeaderFields\fR..SpThe return value is a new \f(CW\*(C`HTTP::Headers\*(C'\fR object that contains theremoved headers only..ie n .IP "$h\->clear" 4.el .IP "\f(CW$h\fR\->clear" 4.IX Item "$h->clear"This will remove all header fields..ie n .IP "$h\->header_field_names" 4.el .IP "\f(CW$h\fR\->header_field_names" 4.IX Item "$h->header_field_names"Returns the list of distinct names for the fields present in theheader.  The field names have case as suggested by \s-1HTTP\s0 spec, and thenames are returned in the recommended \*(L"Good Practice\*(R" order..SpIn scalar context return the number of distinct field names..ie n .IP "$h\->scan( \e&process_header_field )" 4.el .IP "\f(CW$h\fR\->scan( \e&process_header_field )" 4.IX Item "$h->scan( &process_header_field )"Apply a subroutine to each header field in turn.  The callback routineis called with two parameters; the name of the field and a singlevalue (a string).  If a header field is multi-valued, then theroutine is called once for each value.  The field name passed to thecallback routine has case as suggested by \s-1HTTP\s0 spec, and the headerswill be visited in the recommended \*(L"Good Practice\*(R" order..SpAny return values of the callback routine are ignored.  The loop canbe broken by raising an exception (\f(CW\*(C`die\*(C'\fR), but the caller of \fIscan()\fRwould have to trap the exception itself..ie n .IP "$h\->as_string" 4.el .IP "\f(CW$h\fR\->as_string" 4.IX Item "$h->as_string".PD 0.ie n .IP "$h\fR\->as_string( \f(CW$eol )" 4.el .IP "\f(CW$h\fR\->as_string( \f(CW$eol\fR )" 4.IX Item "$h->as_string( $eol )".PDReturn the header fields as a formatted \s-1MIME\s0 header.  Since itinternally uses the \f(CW\*(C`scan\*(C'\fR method to build the string, the resultwill use case as suggested by \s-1HTTP\s0 spec, and it will followrecommended \*(L"Good Practice\*(R" of ordering the header fields.  Long headervalues are not folded..SpThe optional \f(CW$eol\fR parameter specifies the line ending sequence touse.  The default is \*(L"\en\*(R".  Embedded \*(L"\en\*(R" characters in header fieldvalues will be substituted with this line ending sequence..SH "CONVENIENCE METHODS".IX Header "CONVENIENCE METHODS"The most frequently used headers can also be accessed through thefollowing convenience methods.  These methods can both be used to readand to set the value of a header.  The header value is set if you passan argument to the method.  The old header value is always returned.If the given header did not exist then \f(CW\*(C`undef\*(C'\fR is returned..PPMethods that deal with dates/times always convert their value to systemtime (seconds since Jan 1, 1970) and they also expect this kind ofvalue when the header value is set..ie n .IP "$h\->date" 4.el .IP "\f(CW$h\fR\->date" 4.IX Item "$h->date"This header represents the date and time at which the message wasoriginated. \fIE.g.\fR:.Sp.Vb 1\&  $h\->date(time);  # set current date.Ve.ie n .IP "$h\->expires" 4.el .IP "\f(CW$h\fR\->expires" 4.IX Item "$h->expires"This header gives the date and time after which the entity should beconsidered stale..ie n .IP "$h\->if_modified_since" 4.el .IP "\f(CW$h\fR\->if_modified_since" 4.IX Item "$h->if_modified_since".PD 0.ie n .IP "$h\->if_unmodified_since" 4.el .IP "\f(CW$h\fR\->if_unmodified_since" 4.IX Item "$h->if_unmodified_since".PDThese header fields are used to make a request conditional.  If the requestedresource has (or has not) been modified since the time specified in this field,then the server will return a \f(CW\*(C`304 Not Modified\*(C'\fR response instead ofthe document itself..ie n .IP "$h\->last_modified" 4.el .IP "\f(CW$h\fR\->last_modified" 4.IX Item "$h->last_modified"This header indicates the date and time at which the resource was lastmodified. \fIE.g.\fR:.Sp.Vb 6\&  # check if document is more than 1 hour old\&  if (my $last_mod = $h\->last_modified) {\&      if ($last_mod < time \- 60*60) {\&          ...\&      }\&  }.Ve.ie n .IP "$h\->content_type" 4.el .IP "\f(CW$h\fR\->content_type" 4.IX Item "$h->content_type"The Content-Type header field indicates the media type of the messagecontent. \fIE.g.\fR:.Sp.Vb 1\&  $h\->content_type(\*(Aqtext/html\*(Aq);.Ve.SpThe value returned will be converted to lower case, and potentialparameters will be chopped off and returned as a separate value if inan array context.  If there is no such header field, then the emptystring is returned.  This makes it safe to do the following:.Sp.Vb 5\&  if ($h\->content_type eq \*(Aqtext/html\*(Aq) {\&     # we enter this place even if the real header value happens to\&     # be \*(AqTEXT/HTML; version=3.0\*(Aq\&     ...\&  }.Ve.ie n .IP "$h\->content_encoding" 4.el .IP "\f(CW$h\fR\->content_encoding" 4.IX Item "$h->content_encoding"The Content-Encoding header field is used as a modifier to themedia type.  When present, its value indicates what additionalencoding mechanism has been applied to the resource..ie n .IP "$h\->content_length" 4.el .IP "\f(CW$h\fR\->content_length" 4.IX Item "$h->content_length"A decimal number indicating the size in bytes of the message content..ie n .IP "$h\->content_language" 4.el .IP "\f(CW$h\fR\->content_language" 4.IX Item "$h->content_language"The natural language(s) of the intended audience for the messagecontent.  The value is one or more language tags as defined by \s-1RFC\s01766.  Eg. \*(L"no\*(R" for some kind of Norwegian and \*(L"en-US\*(R" for English theway it is written in the \s-1US\s0..ie n .IP "$h\->title" 4.el .IP "\f(CW$h\fR\->title" 4.IX Item "$h->title"The title of the document.  In libwww-perl this header will beinitialized automatically from the <\s-1TITLE\s0>...</TITLE> elementof \s-1HTML\s0 documents.  \fIThis header is no longer part of the \s-1HTTP\s0standard.\fR.ie n .IP "$h\->user_agent" 4.el .IP "\f(CW$h\fR\->user_agent" 4.IX Item "$h->user_agent"This header field is used in request messages and contains informationabout the user agent originating the request.  \fIE.g.\fR:.Sp.Vb 1\&  $h\->user_agent(\*(AqMozilla/1.2\*(Aq);.Ve.ie n .IP "$h\->server" 4.el .IP "\f(CW$h\fR\->server" 4.IX Item "$h->server"The server header field contains information about the software beingused by the originating server program handling the request..ie n .IP "$h\->from" 4.el .IP "\f(CW$h\fR\->from" 4.IX Item "$h->from"This header should contain an Internet e\-mail address for the humanuser who controls the requesting user agent.  The address should bemachine-usable, as defined by \s-1RFC822\s0.  E.g.:.Sp.Vb 1\&  $h\->from(\*(AqKing Kong <king@kong.com>\*(Aq);.Ve.Sp\&\fIThis header is no longer part of the \s-1HTTP\s0 standard.\fR.ie n .IP "$h\->referer" 4.el .IP "\f(CW$h\fR\->referer" 4.IX Item "$h->referer"Used to specify the address (\s-1URI\s0) of the document from which therequested resource address was obtained..SpThe \*(L"Free On-line Dictionary of Computing\*(R" as this to say about theword \fIreferer\fR:.Sp.Vb 6\&     <World\-Wide Web> A misspelling of "referrer" which\&     somehow made it into the {HTTP} standard.  A given {web\&     page}\*(Aqs referer (sic) is the {URL} of whatever web page\&     contains the link that the user followed to the current\&     page.  Most browsers pass this information as part of a\&     request.\&\&     (1998\-10\-19).Ve.SpBy popular demand \f(CW\*(C`referrer\*(C'\fR exists as an alias for this method so youcan avoid this misspelling in your programs and still send the rightthing on the wire..SpWhen setting the referrer, this method removes the fragment from thegiven \s-1URI\s0 if it is present, as mandated by \s-1RFC2616\s0.  Note thatthe removal does \fInot\fR happen automatically if using the \fIheader()\fR,\&\fIpush_header()\fR or \fIinit_header()\fR methods to set the referrer..ie n .IP "$h\->www_authenticate" 4.el .IP "\f(CW$h\fR\->www_authenticate" 4.IX Item "$h->www_authenticate"This header must be included as part of a \f(CW\*(C`401 Unauthorized\*(C'\fR response.The field value consist of a challenge that indicates theauthentication scheme and parameters applicable to the requested \s-1URI\s0..ie n .IP "$h\->proxy_authenticate" 4.el .IP "\f(CW$h\fR\->proxy_authenticate" 4.IX Item "$h->proxy_authenticate"This header must be included in a \f(CW\*(C`407 Proxy Authentication Required\*(C'\fRresponse..ie n .IP "$h\->authorization" 4.el .IP "\f(CW$h\fR\->authorization" 4.IX Item "$h->authorization".PD 0.ie n .IP "$h\->proxy_authorization" 4.el .IP "\f(CW$h\fR\->proxy_authorization" 4.IX Item "$h->proxy_authorization".PDA user agent that wishes to authenticate itself with a server or aproxy, may do so by including these headers..ie n .IP "$h\->authorization_basic" 4.el .IP "\f(CW$h\fR\->authorization_basic" 4.IX Item "$h->authorization_basic"This method is used to get or set an authorization header that use the\&\*(L"Basic Authentication Scheme\*(R".  In array context it will return twovalues; the user name and the password.  In scalar context it willreturn \fI\*(L"uname:password\*(R"\fR as a single string value..SpWhen used to set the header value, it expects two arguments.  \fIE.g.\fR:.Sp.Vb 1\&  $h\->authorization_basic($uname, $password);.Ve.SpThe method will croak if the \f(CW$uname\fR contains a colon ':'..ie n .IP "$h\->proxy_authorization_basic" 4.el .IP "\f(CW$h\fR\->proxy_authorization_basic" 4.IX Item "$h->proxy_authorization_basic"Same as \fIauthorization_basic()\fR but will set the \*(L"Proxy-Authorization\*(R"header instead..SH "NON-CANONICALIZED FIELD NAMES".IX Header "NON-CANONICALIZED FIELD NAMES"The header field name spelling is normally canonicalized including the\&'_' to '\-' translation.  There are some application where this is notappropriate.  Prefixing field names with ':' allow you to force aspecific spelling.  For example if you really want a header field nameto show up as \f(CW\*(C`foo_bar\*(C'\fR instead of \*(L"Foo-Bar\*(R", you might set it likethis:.PP.Vb 1\&  $h\->header(":foo_bar" => 1);.Ve.PPThese field names are returned with the ':' intact for\&\f(CW$h\fR\->header_field_names and the \f(CW$h\fR\->scan callback, but the colons donot show in \f(CW$h\fR\->as_string..SH "COPYRIGHT".IX Header "COPYRIGHT"Copyright 1995\-2005 Gisle Aas..PPThis library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -