Misplaced Pages

List of HTTP header fields

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

In computer programming , a string is traditionally a sequence of characters , either as a literal constant or as some kind of variable . The latter may allow its elements to be mutated and the length changed, or it may be fixed (after creation). A string is generally considered as a data type and is often implemented as an array data structure of bytes (or words ) that stores a sequence of elements, typically characters, using some character encoding . String may also denote more general arrays or other sequence (or list ) data types and structures.

#564435

58-475: HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and response. These headers are usually invisible to the end-user and are only processed or logged by the server and client applications. They define how information sent/received through the connection are encoded (as in Content-Encoding ), the session verification and identification of

116-433: A "array of characters" which may be stored in the same array but is often not null terminated. Using C string handling functions on such an array of characters often seems to work, but later leads to security problems . There are many algorithms for processing strings, each with various trade-offs. Competing algorithms can be analyzed with respect to run time, storage requirements, and so forth. The name stringology

174-414: A 10-byte buffer , along with its ASCII (or more modern UTF-8 ) representation as 8-bit hexadecimal numbers is: The length of the string in the above example, " FRANK ", is 5 characters, but it occupies 6 bytes. Characters after the terminator do not form part of the representation; they may be either part of other data or just garbage. (Strings of this form are sometimes called ASCIZ strings , after

232-480: A best effort not to write it to disk (i.e not to cache it). The request that a resource should not be cached is no guarantee that it will not be written to disk. In particular, the HTTP/1.1 definition draws a distinction between history stores and caches. If the user navigates back to a previous page a browser may still show you a page that has been stored on disk in the history store. This is correct behavior according to

290-423: A browser or proxy to not use the cache contents merely based on "freshness criteria" of the cache content. Another common way to prevent old content from being shown to the user without validation is Cache-Control: max-age=0 . This instructs the user agent that the content is stale and should be validated before use. The header field Cache-Control: no-store is intended to instruct a browser application to make

348-449: A byte value in the ASCII range will represent only that ASCII character, making the encoding safe for systems that use those characters as field separators. Other encodings such as ISO-2022 and Shift-JIS do not make such guarantees, making matching on byte codes unsafe. These encodings also were not "self-synchronizing", so that locating character boundaries required backing up to the start of

406-765: A colon ( : ). A core set of fields is standardized by the Internet Engineering Task Force (IETF) in RFC   9110 and 9111 . The Field Names , Header Fields and Repository of Provisional Registrations are maintained by the IANA . Additional field names and permissible values may be defined by each application. Header field names are case-insensitive. This is in contrast to HTTP method names (GET, POST, etc.), which are case-sensitive. HTTP/2 makes some restrictions on specific header fields (see below). Non-standard header fields were conventionally marked by prefixing

464-441: A computer program to the user of the program. A program may also accept string input from its user. Further, strings may store data expressed as characters yet not intended for human reading. Example strings and their purposes: The term string may also designate a sequence of data or computer records other than characters — like a "string of bits " — but when used without qualification it refers to strings of characters. Use of

522-462: A consequence, some people call such a string a Pascal string or P-string . Storing the string length as byte limits the maximum string length to 255. To avoid such limitations, improved implementations of P-strings use 16-, 32-, or 64-bit words to store the string length. When the length field covers the address space , strings are limited only by the available memory . If the length is bounded, then it can be encoded in constant space, typically

580-533: A dedicated string datatype at all, instead adopting the convention of representing strings as lists of character codes. Even in programming languages having a dedicated string type, string can usually be iterated as a sequence character codes, like lists of integers or other values. Representations of strings depend heavily on the choice of character repertoire and the method of character encoding. Older string implementations were designed to work with repertoire and encoding defined by ASCII, or more recent extensions like

638-414: A fixed length. A few languages such as Haskell implement them as linked lists instead. A lot of high-level languages provide strings as a primitive data type, such as JavaScript and PHP , while most others provide them as a composite data type, some with special language support in writing literals, for example, Java and C# . Some languages, such as C , Prolog and Erlang , avoid implementing

SECTION 10

#1732854631565

696-462: A length code are limited to the maximum value of the length code. Both of these limitations can be overcome by clever programming. It is possible to create data structures and functions that manipulate them that do not have the problems associated with character termination and can in principle overcome length code bounds. It is also possible to optimize the string represented using techniques from run length encoding (replacing repeated characters by

754-449: A machine word, thus leading to an implicit data structure , taking n + k space, where k is the number of characters in a word (8 for 8-bit ASCII on a 64-bit machine, 1 for 32-bit UTF-32/UCS-4 on a 32-bit machine, etc.). If the length is not bounded, encoding a length n takes log( n ) space (see fixed-length code ), so length-prefixed strings are a succinct data structure , encoding a string of length n in log( n ) + n space. In

812-465: A one 8-bit byte per-character encoding) for reasonable representation. The normal solutions involved keeping single-byte representations for ASCII and using two-byte representations for CJK ideographs . Use of these with existing code led to problems with matching and cutting of strings, the severity of which depended on how the character encoding was designed. Some encodings such as the EUC family guarantee that

870-542: A program treated specially (such as period and space and comma) were in the same place in all the encodings a program would encounter. These character sets were typically based on ASCII or EBCDIC . If text in one encoding was displayed on a system using a different encoding, text was often mangled , though often somewhat readable and some computer users learned to read the mangled text. Logographic languages such as Chinese , Japanese , and Korean (known collectively as CJK ) need far more than 256 characters (the limit of

928-531: A response to be used without re-checking it on the origin server, and can be controlled by both the server and the client. For example, the Expires response header gives a date when the document becomes stale, and the Cache-Control: max-age directive tells the cache how many seconds the response is fresh for. Validation can be used to check whether a cached response is still good after it becomes stale. For example, if

986-478: A separate integer (which may put another artificial limit on the length) or implicitly through a termination character, usually a character value with all bits zero such as in C programming language. See also " Null-terminated " below. String datatypes have historically allocated one byte per character, and, although the exact character set varied by region, character encodings were similar enough that programmers could often get away with ignoring this, since characters

1044-405: A single long consecutive array of characters, a typical text editor instead uses an alternative representation as its sequence data structure—a gap buffer , a linked list of lines, a piece table , or a rope —which makes certain string operations, such as insertions, deletions, and undoing previous edits, more efficient. The differing memory layout and storage requirements of strings can affect

1102-402: A string, and pasting two strings together could result in corruption of the second string. Unicode has simplified the picture somewhat. Most programming languages now have a datatype for Unicode strings. Unicode's preferred byte stream format UTF-8 is designed not to have the problems described above for older multibyte encodings. UTF-8, UTF-16 and UTF-32 require the programmer to know that

1160-456: A string, usually quoted in some way, to represent an instance of a string datatype; such a meta-string is called a literal or string literal . Although formal strings can have an arbitrary finite length, the length of strings in real languages is often constrained to an artificial maximum. In general, there are two types of string datatypes: fixed-length strings , which have a fixed maximum length to be determined at compile time and which use

1218-404: A string-specific datatype, depending on the needs of the application, the desire of the programmer, and the capabilities of the programming language being used. If the programming language's string implementation is not 8-bit clean , data corruption may ensue. C programmers draw a sharp distinction between a "string", aka a "string of characters", which by definition is always null terminated, vs.

SECTION 20

#1732854631565

1276-497: A termination value. Most string implementations are very similar to variable-length arrays with the entries storing the character codes of corresponding characters. The principal difference is that, with certain encodings, a single logical character may take up more than one entry in the array. This happens for example with UTF-8, where single codes ( UCS code points) can take anywhere from one to four bytes, and single characters can take an arbitrary number of codes. In these cases,

1334-474: A text file that is both human-readable and intended for consumption by a machine. This is needed in, for example, source code of programming languages, or in configuration files. In this case, the NUL character does not work well as a terminator since it is normally invisible (non-printable) and is difficult to input via a keyboard. Storing the string length would also be inconvenient as manual computation and tracking of

1392-400: A time earlier than the response time. Notice that no-cache is not instructing the browser or proxies about whether or not to cache the content. It just tells the browser and proxies to validate the cache content with the server before using it (this is done by using If-Modified-Since, If-Unmodified-Since, If-Match, If-None-Match attributes mentioned above). Sending a no-cache value thus instructs

1450-474: A variable number of elements. When a string appears literally in source code , it is known as a string literal or an anonymous string. In formal languages , which are used in mathematical logic and theoretical computer science , a string is a finite sequence of symbols that are chosen from a set called an alphabet . A primary purpose of strings is to store human-readable text, like words and sentences. Strings are used to communicate information from

1508-498: A web server responds with Cache-Control: no-cache then a web browser or other caching system (intermediate proxies) must not use the response to satisfy subsequent requests without first checking with the originating server (this process is called validation). This header field is part of HTTP version 1.1, and is ignored by some caches and browsers. It may be simulated by setting the Expires HTTP version 1.0 header field value to

1566-549: A weight to use in content negotiation . For example, a browser may indicate that it accepts information in German or English, with German as preferred by setting the q value for de higher than that of en , as follows: Accept-Language: de; q=1.0, en; q=0.5 The standard imposes no limits to the size of each header field name or value, or to the number of fields. However, most servers, clients, and proxy software impose some limits for practical and security reasons. For example,

1624-417: Is commonly referred to as a C string . This representation of an n -character string takes n + 1 space (1 for the terminator), and is thus an implicit data structure . In terminated strings, the terminating code is not an allowable character in any string. Strings with length field do not have this limitation and can also store arbitrary binary data . An example of a null-terminated string stored in

1682-609: Is immaterial. According to Jean E. Sammet , "the first realistic string handling and pattern matching language" for computers was COMIT in the 1950s, followed by the SNOBOL language of the early 1960s. A string datatype is a datatype modeled on the idea of a formal string. Strings are such an important and useful datatype that they are implemented in nearly every programming language . In some languages they are available as primitive types and in others as composite types . The syntax of most high-level programming languages allows for

1740-598: Is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License , but not under the GFDL . All relevant terms must be followed. String (computer science) Depending on the programming language and precise data type used, a variable declared to be a string may either cause storage in memory to be statically allocated for a predetermined maximum length or employ dynamic allocation to allow it to hold

1798-518: Is the X-REQUEST-ID http header?" , authored by Stefan Kögl at Stack Exchange, which is licensed in a way that permits reuse under the Creative Commons Attribution-ShareAlike 3.0 Unported License , but not under the GFDL . All relevant terms must be followed. As of this edit , this article uses content from "Why does ASP.NET framework add the 'X-Powered-By:ASP.NET' HTTP Header in responses?" , authored by Adrian Grigore at Stack Exchange, which

List of HTTP header fields - Misplaced Pages Continue

1856-509: The ISO 8859 series. Modern implementations often use the extensive repertoire defined by Unicode along with a variety of complex encodings such as UTF-8 and UTF-16. The term byte string usually indicates a general-purpose string of bytes, rather than strings of only (readable) characters, strings of bits, or such. Byte strings often imply that bytes can take any value and any data can be stored as-is, meaning that there should be no value interpreted as

1914-458: The formal behavior of symbolic systems, setting aside the symbols' meaning. For example, logician C. I. Lewis wrote in 1918: A mathematical system is any set of strings of recognisable marks in which some of the strings are taken initially and the remainder derived from these by operations performed according to rules which are independent of any meaning assigned to the marks. That a system should consist of 'marks' instead of sounds or odours

1972-1044: The Apache 2.3 server by default limits the size of each field to 8,190 bytes, and there can be at most 100 header fields in a single request. Must not be used with HTTP/2. Connection: Upgrade Mandatory since HTTP/1.1. If the request is generated directly in HTTP/2, it should not be used. Host: en.wikipedia.org Only trailers is supported in HTTP/2. Must not be used with HTTP/2. Must not be used in HTTP/2. DNT: 0 (Do Not Track Disabled) X-Forwarded-For: 129.78.138.66, 129.78.64.103 X-Forwarded-Host: en.wikipedia.org Must not be used with HTTP/2. X-Correlation-ID, Correlation-ID When using HTTP/2, servers should instead send an ALTSVC frame. Must not be used with HTTP/2. Permanent Must not be used with HTTP/2. Must not be used in HTTP/2 Timing-Allow-Origin: <origin>[, <origin>]* If

2030-423: The HTTP/1.0 spec, has the same purpose. It, however, is only defined for the request header. Its meaning in a response header is not specified. The behavior of Pragma: no-cache in a response is implementation specific. While some user agents do pay attention to this field in responses, the HTTP/1.1 RFC specifically warns against relying on this behavior. As of this edit , this article uses content from "What

2088-454: The Internet and reducing peak server load. This is usually a content delivery network (CDN) that retains copies of web content at various points throughout a network. The Hypertext Transfer Protocol (HTTP) defines three basic mechanisms for controlling caches: freshness, validation, and invalidation. This is specified in the header of HTTP response messages from the server. Freshness allows

2146-484: The Web. A forward cache is a cache outside the web server 's network, e.g. in the client's web browser , in an ISP , or within a corporate network. A network-aware forward cache only caches heavily accessed items. A proxy server sitting between the client and web server can evaluate HTTP headers and choose whether to store web content. A reverse cache sits in front of one or more web servers, accelerating requests from

2204-433: The assignment of the seventh bit to (for example) handle ASCII codes. Early microcomputer software relied upon the fact that ASCII codes do not use the high-order bit, and set it to indicate the end of a string. It must be reset to 0 prior to output. The length of a string can also be stored explicitly, for example by prefixing the string with the length as a byte value. This convention is used in many Pascal dialects; as

2262-435: The character value and a length) and Hamming encoding . While these representations are common, others are possible. Using ropes makes certain string operations, such as insertions, deletions, and concatenations more efficient. The core data structure in a text editor is the one that manages the string (sequence of characters) that represents the current state of the file being edited. While that state could be stored in

2320-465: The client (as in browser cookies , IP address, user-agent ) or their anonymity thereof (VPN or proxy masking, user-agent spoofing), how the server should handle data (as in Do-Not-Track ), the age (the time it has resided in a shared cache ) of the document being downloaded, amongst others. In HTTP version 1.x, header fields are transmitted after the request line (in case of a request HTTP message) or

2378-594: The field name with X- but this convention was deprecated in June 2012 because of the inconveniences it caused when non-standard fields became standard. An earlier restriction on use of Downgraded- was lifted in March 2013. A few fields can contain comments (i.e. in User-Agent, Server, Via fields), which can be ignored by software. Many field values may contain a quality ( q ) key-value pair separated by equals sign , specifying

List of HTTP header fields - Misplaced Pages Continue

2436-507: The fixed-size code units are different from the "characters", the main difficulty currently is incorrectly designed APIs that attempt to hide this difference (UTF-32 does make code points fixed-sized, but these are not "characters" due to composing codes). Some languages, such as C++ , Perl and Ruby , normally allow the contents of a string to be changed after it has been created; these are termed mutable strings. In other languages, such as Java , JavaScript , Lua , Python , and Go ,

2494-430: The implementation is usually hidden , the string must be accessed and modified through member functions. text is a pointer to a dynamically allocated memory area, which might be expanded as needed. See also string (C++) . Both character termination and length codes limit strings: For example, C character arrays that contain null (NUL) characters cannot be handled directly by C string library functions: Strings using

2552-428: The latter case, the length-prefix field itself does not have fixed length, therefore the actual string data needs to be moved when the string grows such that the length field needs to be increased. Here is a Pascal string stored in a 10-byte buffer, along with its ASCII / UTF-8 representation: Many languages, including object-oriented ones, implement strings as records with an internal structure like: However, since

2610-407: The length is tedious and error-prone. Two common representations are: While character strings are very common uses of strings, a string in computer science may refer generically to any sequence of homogeneously typed data. A bit string or byte string , for example, may be used to represent non-textual binary data retrieved from a communications medium. This data may or may not be represented by

2668-436: The logical length of the string (number of characters) differs from the physical length of the array (number of bytes in use). UTF-32 avoids the first part of the problem. The length of a string can be stored implicitly by using a special terminating character; often this is the null character (NUL), which has all bits zero, a convention used and perpetuated by the popular C programming language . Hence, this representation

2726-447: The original assembly language directive used to declare them.) Using a special byte other than null for terminating strings has historically appeared in both hardware and software, though sometimes with a value that was also a printing character. $ was used by many assembler systems, : used by CDC systems (this character had a value of zero), and the ZX80 used " since this was

2784-533: The presence of a space (SP) or horizontal tab (HT) as the first character on the next line. This folding was deprecated in RFC 7230. HTTP/2 and HTTP/3 instead use a binary protocol , where headers are encoded in a single HEADERS and zero or more CONTINUATION frames using HPACK (HTTP/2) or QPACK (HTTP/3), which both provide efficient header compression. The request or response line from HTTP/1 has also been replaced by several pseudo-header fields, each beginning with

2842-480: The response has a Last-Modified header, a cache can make a conditional request using the If-Modified-Since header to see if it has changed. The ETag (entity tag) mechanism also allows for both strong and weak validation. Invalidation is usually a side effect of another request that passes through the cache. For example, if a URL associated with a cached response subsequently gets a POST, PUT or DELETE request,

2900-480: The response line (in case of a response HTTP message), which is the first line of a message. Header fields are colon-separated key-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence. The end of the header section is indicated by an empty field line, resulting in the transmission of two consecutive CR-LF pairs. In the past, long lines could be folded into multiple lines; continuation lines are indicated by

2958-472: The same amount of memory whether this maximum is needed or not, and variable-length strings , whose length is not arbitrarily fixed and which can use varying amounts of memory depending on the actual requirements at run time (see Memory management ). Most strings in modern programming languages are variable-length strings. Of course, even variable-length strings are limited in length – by the size of available computer memory . The string length can be stored as

SECTION 50

#1732854631565

3016-434: The security of the program accessing the string data. String representations requiring a terminating character are commonly susceptible to buffer overflow problems if the terminating character is not present, caused by a coding error or an attacker deliberately altering the data. String representations adopting a separate length field are also susceptible if the length can be manipulated. In such cases, program code accessing

3074-449: The specification. Many user agents show different behavior in loading pages from the history store or cache depending on whether the protocol is HTTP or HTTPS. The Cache-Control: no-cache HTTP/1.1 header field is also intended for use in requests made by the client. It is a means for the browser to tell the server and any intermediate caches that it wants a fresh version of the resource. The Pragma: no-cache header field, defined in

3132-497: The string data requires bounds checking to ensure that it does not inadvertently access or change data outside of the string memory limits. String data is frequently obtained from user input to a program. As such, it is the responsibility of the program to validate the string to ensure that it represents the expected format. Performing limited or no validation of user input can cause a program to be vulnerable to code injection attacks. Sometimes, strings need to be embedded inside

3190-493: The string delimiter in its BASIC language. Somewhat similar, "data processing" machines like the IBM 1401 used a special word mark bit to delimit strings at the left, where the operation would start at the right. This bit had to be clear in all other parts of the string. This meant that, while the IBM 1401 had a seven-bit word, almost no-one ever thought to use this as a feature, and override

3248-768: The value is fixed and a new string must be created if any alteration is to be made; these are termed immutable strings. Some of these languages with immutable strings also provide another type that is mutable, such as Java and .NET 's StringBuilder , the thread-safe Java StringBuffer , and the Cocoa NSMutableString . There are both advantages and disadvantages to immutability: although immutable strings may require inefficiently creating many copies, they are simpler and completely thread-safe . Strings are typically implemented as arrays of bytes, characters, or code units, in order to allow fast access to individual units or substrings—including characters when they have

3306-463: The word "string" to mean any items arranged in a line, series or succession dates back centuries. In 19th-Century typesetting, compositors used the term "string" to denote a length of type printed on paper; the string would be measured to determine the compositor's pay. Use of the word "string" to mean "a sequence of symbols or linguistic elements in a definite order" emerged from mathematics, symbolic logic , and linguistic theory to speak about

3364-473: Was coined in 1984 by computer scientist Zvi Galil for the theory of algorithms and data structures used for string processing. Some categories of algorithms include: HTTP cache A Web cache (or HTTP cache ) is a system for optimizing the World Wide Web. It is implemented both client-side and server-side. The caching of multimedia and other files can result in less overall delay when browsing

#564435