RFC 2068 ABNF Productions
Rule Name Production or Comment

OCTET

= <any 8-bit sequence of data>

CHAR

= <any US-ASCII character (octets 0 - 127)>

UPALPHA

= <any US-ASCII uppercase letter "A".."Z">

LOALPHA

= <any US-ASCII lowercase letter "a".."z">

ALPHA

= UPALPHA | LOALPHA

DIGIT

= <any US-ASCII digit "0".."9">

CTL

= <any US-ASCII control character (octets 0 - 31) and DEL (127)>

CR

= <US-ASCII CR, carriage return (13)>

LF

= <US-ASCII LF, linefeed (10)>

SP

= <US-ASCII SP, space (32)>

HT

= <US-ASCII HT, horizontal-tab (9)>

DQUOTE

= <US-ASCII double-quote mark (34)>

CRLF

= CR LF

LWS

= [CRLF] 1*( SP | HT )

TEXT

= <any OCTET except CTLs, but including LWS>

HEX

= "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f" | DIGIT

token

= 1*<any CHAR except CTLs or tspecials>

tspecials

= "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | DQUOTE | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT

comment

= "(" *( ctext | comment ) ")"

ctext

= <any TEXT excluding "(" and ")">

quoted-string

= ( DQUOTE *( qdtext ) DQUOTE )

qdtext

= <any TEXT except DQUOTE>

quoted-pair

= "\" CHAR

HTTP-Version

= "HTTP" "/" 1*DIGIT "." 1*DIGIT

URI

= ( absoluteURI | relativeURI ) ["#" fragment]

absoluteURI

= scheme ":" *( uchar | reserved )

relativeURI

= net_path | abs_path | rel_path

net_path

= "//" net_loc [abs_path]

abs_path

= "/" rel_path

rel_path

= [path] [";" params] ["?" query]

path

= fsegment *( "/" segment )

fsegment

= 1*pchar

segment

= *pchar

params

= param *( ";" param )

param

= *( pchar | "/" )

scheme

= 1*( ALPHA | DIGIT | "+" | "-" | "." )

net_loc

= *( pchar | ";" | "?" )

query

= *( uchar | reserved )

fragment

= *( uchar | reserved )

pchar

= uchar | ":" | "@" | "&" | "=" | "+"

uchar

= unreserved | escape

unreserved

= ALPHA | DIGIT | safe | extra | national

escape

= "%" HEX HEX

reserved

= ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+"

extra

= "!" | "*" | "'" | "(" | ")" | ","

safe

= "$" | "-" | "_" | "."

unsafe

= CTL | SP | DQUOTE | "#" | "%" | "<" | ">"

national

= <any OCTET excluding ALPHA, DIGIT, reserved, extra, safe, and unsafe>

http_URL

= "http:" "//" host [":" port] [abs_path]

host

= <A legal Internet host domain name or IP address (in dotted-decimal form), as defined by Section 2.1 of RFC 1123>

port

= *DIGIT

HTTP-date

= rfc1123-date | rfc850-date | asctime-date

rfc1123-date

= wkday "," SP date1 SP time SP "GMT"

rfc850-date

= weekday "," SP date2 SP time SP "GMT"

asctime-date

= wkday SP date3 SP time SP 4DIGIT

date1

= 2DIGIT SP month SP 4DIGIT  ; day month year (e.g., 02 Jun 1982)

date2

= 2DIGIT "-" month "-" 2DIGIT  ; day-month-year (e.g., 02-Jun-82)

date3

= month SP ( 2DIGIT | ( SP 1DIGIT ) )  ; month day (e.g., Jun 2)

time

= 2DIGIT ":" 2DIGIT ":" 2DIGIT  ; 00:00:00 - 23:59:59

wkday

= "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"

weekday

= "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday"

month

= "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" | "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"

delta-seconds

= 1*DIGIT

charset

= token

content-coding

= token

transfer-coding

= "chunked" | transfer-extension

transfer-extension

= token

Chunked-Body

= *chunk "0" CRLF footer CRLF

chunk

= chunk-size [chunk-ext] CRLF chunk-data CRLF

hex-no-zero

= <HEX excluding "0">

chunk-size

= hex-no-zero *HEX

chunk-ext

= *( ";" chunk-ext-name ["=" chunk-ext-value] )

chunk-ext-name

= token

chunk-ext-value

= token | quoted-string

chunk-data

= chunk-size ( OCTET )

footer

= *entity-header

media-type

= type "/" subtype *( ";" parameter )

type

= token

subtype

= token

parameter

= attribute "=" value

attribute

= token

value

= token | quoted-string

product

= token ["/" product-version]

product-version

= token

qvalue

= ( "0" ["." 0*3DIGIT] ) | ( "1" ["." 0*3( "0" )] )

language-tag

= primary-tag *( "-" subtag )

primary-tag

= 1*8ALPHA

subtag

= 1*8ALPHA

entity-tag

= [weak] opaque-tag

weak

= "W/"

opaque-tag

= quoted-string

range-unit

= bytes-unit | other-range-unit

bytes-unit

= "bytes"

other-range-unit

= token

HTTP-message

= Request | Response  ; HTTP/1.1 messages

generic-message

= start-line *message-header CRLF [message-body]

start-line

= Request-Line | Status-Line

message-header

= field-name ":" [field-value] CRLF

field-name

= token

field-value

= *( field-content | LWS )

field-content

= <the OCTETs making up the field-value and consisting of either *TEXT or combinations of token, tspecials, and quoted-string>

message-body

= entity-body | <entity-body encoded as per Transfer-Encoding>

general-header

= Cache-Control  ; Section 14.9
| Connection  ; Section 14.10
| Date  ; Section 14.19
| Pragma  ; Section 14.32
| Transfer-Encoding  ; Section 14.40
| Upgrade  ; Section 14.41
| Via  ; Section 14.44

Request

= Request-Line   ; Section 5.1
*( general-header  ; Section 4.5
| request-header  ; Section 5.3
| entity-header )   ; Section 7.1
CRLF [message-body]  ; Section 7.2

Request-Line

= Method SP Request-URI SP HTTP-Version CRLF

Method

= "OPTIONS"  ; Section 9.2
| "GET"  ; Section 9.3
| "HEAD"  ; Section 9.4
| "POST"  ; Section 9.5
| "PUT"  ; Section 9.6
| "DELETE"  ; Section 9.7
| "TRACE"  ; Section 9.8
| extension-method

extension-method

= token

Request-URI

= "*" | absoluteURI | abs_path

request-header

= Accept  ; Section 14.1
| Accept-Charset  ; Section 14.2
| Accept-Encoding  ; Section 14.3
| Accept-Language  ; Section 14.4
| Authorization  ; Section 14.8
| From  ; Section 14.22
| Host  ; Section 14.23
| If-Modified-Since  ; Section 14.24
| If-Match  ; Section 14.25
| If-None-Match  ; Section 14.26
| If-Range  ; Section 14.27
| If-Unmodified-Since  ; Section 14.28
| Max-Forwards  ; Section 14.31
| Proxy-Authorization  ; Section 14.34
| Range  ; Section 14.36
| Referer  ; Section 14.37
| User-Agent  ; Section 14.42

Response

= Status-Line   ; Section 6.1
*( general-header  ; Section 4.5
| response-header  ; Section 6.2
| entity-header )   ; Section 7.1
CRLF [message-body]  ; Section 7.2

Status-Line

= HTTP-Version SP Status-Code SP Reason-Phrase CRLF

Status-Code

= "100"  ; Continue
| "101"  ; Switching Protocols
| "200"  ; OK
| "201"  ; Created
| "202"  ; Accepted
| "203"  ; Non-Authoritative Information
| "204"  ; No Content
| "205"  ; Reset Content
| "206"  ; Partial Content
| "300"  ; Multiple Choices
| "301"  ; Moved Permanently
| "302"  ; Moved Temporarily
| "303"  ; See Other
| "304"  ; Not Modified
| "305"  ; Use Proxy
| "400"  ; Bad Request
| "401"  ; Unauthorized
| "402"  ; Payment Required
| "403"  ; Forbidden
| "404"  ; Not Found
| "405"  ; Method Not Allowed
| "406"  ; Not Acceptable
| "407"  ; Proxy Authentication Required
| "408"  ; Request Time-out
| "409"  ; Conflict
| "410"  ; Gone
| "411"  ; Length Required
| "412"  ; Precondition Failed
| "413"  ; Request Entity Too Large
| "414"  ; Request-URI Too Large
| "415"  ; Unsupported Media Type
| "500"  ; Internal Server Error
| "501"  ; Not Implemented
| "502"  ; Bad Gateway
| "503"  ; Service Unavailable
| "504"  ; Gateway Time-out
| "505"  ; HTTP Version not supported
| extension-code

extension-code

= 3DIGIT

Reason-Phrase

= *<TEXT, excluding CR, LF>

response-header

= Age  ; Section 14.6
| Location  ; Section 14.30
| Proxy-Authenticate  ; Section 14.33
| Public  ; Section 14.35
| Retry-After  ; Section 14.38
| Server  ; Section 14.39
| Vary  ; Section 14.43
| Warning  ; Section 14.45
| WWW-Authenticate  ; Section 14.46

entity-header

= Allow  ; Section 14.7
| Content-Base  ; Section 14.11
| Content-Encoding  ; Section 14.12
| Content-Language  ; Section 14.13
| Content-Length  ; Section 14.14
| Content-Location  ; Section 14.15
| Content-MD5  ; Section 14.16
| Content-Range  ; Section 14.17
| Content-Type  ; Section 14.18
| ETag  ; Section 14.20
| Expires  ; Section 14.21
| Last-Modified  ; Section 14.29
| extension-header

extension-header

= message-header

entity-body

= *OCTET

auth-scheme

= token

auth-param

= token "=" quoted-string

challenge

= auth-scheme 1*SP realm *( "," auth-param )

realm

= "realm" "=" realm-value

realm-value

= quoted-string

credentials

= basic-credentials | auth-scheme #auth-param

basic-credentials

= "Basic" SP basic-cookie

basic-cookie

= <base64 [7] encoding of> user-pass <except not limited to 76 char/line>

user-pass

= userid ":" password

userid

= *<TEXT excluding ":">

password

= *TEXT

Accept

= "Accept" ":" #( media-range [accept-params] )

media-range

= ( "*/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter )

accept-params

= ";" "q" "=" qvalue *( accept-extension )

accept-extension

= ";" token ["=" ( token | quoted-string )]

Accept-Charset

= "Accept-Charset" ":" 1#( charset [";" "q" "=" qvalue] )

Accept-Encoding

= "Accept-Encoding" ":" #( content-coding )

Accept-Language

= "Accept-Language" ":" 1#( language-range [";" "q" "=" qvalue] )

language-range

= ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )

Accept-Ranges

= "Accept-Ranges" ":" acceptable-ranges

acceptable-ranges

= 1#range-unit | "none"

Age

= "Age" ":" age-value

age-value

= delta-seconds

Allow

= "Allow" ":" 1#method

Authorization

= "Authorization" ":" credentials

Cache-Control

= "Cache-Control" ":" 1#cache-directive

cache-directive

= cache-request-directive | cache-response-directive

cache-request-directive

= "no-cache" ["=" DQUOTE 1#field-name DQUOTE] | "no-store" | "max-age" "=" delta-seconds | "max-stale" ["=" delta-seconds] | "min-fresh" "=" delta-seconds | "only-if-cached" | cache-extension

cache-response-directive

= "public" | "private" ["=" DQUOTE 1#field-name DQUOTE] | "no-cache" ["=" DQUOTE 1#field-name DQUOTE] | "no-store" | "no-transform" | "must-revalidate" | "proxy-revalidate" | "max-age" "=" delta-seconds | cache-extension

cache-extension

= token ["=" ( token | quoted-string )]

Connection

= Connection-header  ; added to remove orphan Connection-header

Connection-header

= "Connection" ":" 1#( connection-token )

connection-token

= token

Content-Base

= "Content-Base" ":" absoluteURI

Content-Encoding

= "Content-Encoding" ":" 1#content-coding

Content-Language

= "Content-Language" ":" 1#language-tag

Content-Length

= "Content-Length" ":" 1*DIGIT

Content-Location

= "Content-Location" ":" ( absoluteURI | relativeURI )

Content-MD5

= "Content-MD5" ":" md5-digest

md5-digest

= <base64 of 128 bit MD5 digest as per RFC 1864>

Content-Range

= "Content-Range" ":" content-range-spec

content-range-spec

= byte-content-range-spec

byte-content-range-spec

= bytes-unit SP first-byte-pos "-" last-byte-pos "/" entity-length

entity-length

= 1*DIGIT

Content-Type

= "Content-Type" ":" media-type

Date

= "Date" ":" HTTP-date

ETag

= "ETag" ":" entity-tag

Expires

= "Expires" ":" HTTP-date

From

= "From" ":" mailbox

mailbox

= <defined in RFC 822 (as updated by RFC 1123)>

Host

= "Host" ":" host [":" port]  ; Section 3.2.2

If-Modified-Since

= "If-Modified-Since" ":" HTTP-date

If-Match

= "If-Match" ":" ( "*" | 1#entity-tag )

If-None-Match

= "If-None-Match" ":" ( "*" | 1#entity-tag )

If-Range

= "If-Range" ":" ( entity-tag | HTTP-date )

If-Unmodified-Since

= "If-Unmodified-Since" ":" HTTP-date

Last-Modified

= "Last-Modified" ":" HTTP-date

Location

= "Location" ":" absoluteURI

Max-Forwards

= "Max-Forwards" ":" 1*DIGIT

Pragma

= "Pragma" ":" 1#pragma-directive

pragma-directive

= "no-cache" | extension-pragma

extension-pragma

= token ["=" ( token | quoted-string )]

Proxy-Authenticate

= "Proxy-Authenticate" ":" challenge

Proxy-Authorization

= "Proxy-Authorization" ":" credentials

Public

= "Public" ":" 1#method

ranges-specifier

= byte-ranges-specifier

byte-ranges-specifier

= bytes-unit "=" byte-range-set

byte-range-set

= 1#( byte-range-spec | suffix-byte-range-spec )

byte-range-spec

= first-byte-pos "-" [last-byte-pos]

first-byte-pos

= 1*DIGIT

last-byte-pos

= 1*DIGIT

suffix-byte-range-spec

= "-" suffix-length

suffix-length

= 1*DIGIT

Range

= "Range" ":" ranges-specifier

Referer

= "Referer" ":" ( absoluteURI | relativeURI )

Retry-After

= "Retry-After" ":" ( HTTP-date | delta-seconds )

Server

= "Server" ":" 1*( product | comment )

Transfer-Encoding

= "Transfer-Encoding" ":" 1#transfer-coding

Upgrade

= "Upgrade" ":" 1#product

User-Agent

= "User-Agent" ":" 1*( product | comment )

Vary

= "Vary" ":" ( "*" | 1#field-name )

Via

= "Via" ":" 1#( received-protocol received-by [comment] )

received-protocol

= [protocol-name "/"] protocol-version

protocol-name

= token

protocol-version

= token

received-by

= ( host [":" port] ) | pseudonym

pseudonym

= token

Warning

= "Warning" ":" 1#warning-value

warning-value

= warn-code SP warn-agent SP warn-text

warn-code

= 2DIGIT

warn-agent

= ( host [":" port] ) | pseudonym  ; the name or pseudonym of the server adding
  ; the Warning header, for use in debugging

warn-text

= quoted-string

WWW-Authenticate

= "WWW-Authenticate" ":" 1#challenge

MIME-Version

= "MIME-Version" ":" 1*DIGIT "." 1*DIGIT

Content-Version

= "Content-Version" ":" quoted-string

Derived-From

= "Derived-From" ":" quoted-string

Link

= "Link" ":" #( "<" URI ">" *( ";" link-param ) )

link-param

= ( ( "rel" "=" relationship ) | ( "rev" "=" relationship ) | ( "title" "=" quoted-string ) | ( "anchor" "=" DQUOTE URI DQUOTE ) | ( link-extension ) )

link-extension

= token ["=" ( token | quoted-string )]

relationship

= sgml-name | ( DQUOTE sgml-name *( SP sgml-name ) DQUOTE )

sgml-name

= ALPHA *( ALPHA | DIGIT | "." | "-" )

URI-header

= "URI" ":" 1#( "<" URI ">" )

Keep-Alive-header

= "Keep-Alive" ":" 0#keepalive-param

keepalive-param

= param-name "=" value

param-name

= <HTTP/1.1 does not define any paramters>
Symbol Cross Reference List
Reference Productions which Reference this Symbol
ALPHA scheme, unreserved, primary-tag, subtag, language-range, language-range, sgml-name, sgml-name
Accept request-header
Accept-Charset request-header
Accept-Encoding request-header
Accept-Language request-header
Age response-header
Allow entity-header
Authorization request-header
CHAR quoted-pair
CR CRLF
CRLF LWS, Chunked-Body, Chunked-Body, chunk, chunk, generic-message, message-header, Request, Request-Line, Response, Status-Line
CTL unsafe
Cache-Control general-header
Connection general-header
Connection-header Connection
Content-Base entity-header
Content-Encoding entity-header
Content-Language entity-header
Content-Length entity-header
Content-Location entity-header
Content-MD5 entity-header
Content-Range entity-header
Content-Type entity-header
DIGIT HEX, HTTP-Version, HTTP-Version, scheme, unreserved, port, asctime-date, date1, date1, date2, date2, date3, date3, time, time, time, delta-seconds, qvalue, extension-code, Content-Length, entity-length, Max-Forwards, first-byte-pos, last-byte-pos, suffix-length, warn-code, MIME-Version, MIME-Version, sgml-name
DQUOTE tspecials, quoted-string, quoted-string, unsafe, cache-request-directive, cache-request-directive, cache-response-directive, cache-response-directive, cache-response-directive, cache-response-directive, link-param, link-param, relationship, relationship
Date general-header
ETag entity-header
Expires entity-header
From request-header
HEX escape, escape, chunk-size
HT LWS, tspecials
HTTP-Version Request-Line, Status-Line
HTTP-date Date, Expires, If-Modified-Since, If-Range, If-Unmodified-Since, Last-Modified, Retry-After
Host request-header
If-Match request-header
If-Modified-Since request-header
If-None-Match request-header
If-Range request-header
If-Unmodified-Since request-header
LF CRLF
LOALPHA ALPHA
LWS field-value
Last-Modified entity-header
Location response-header
Max-Forwards request-header
Method Request-Line
OCTET chunk-data, entity-body
Pragma general-header
Proxy-Authenticate response-header
Proxy-Authorization request-header
Public response-header
Range request-header
Reason-Phrase Status-Line
Referer request-header
Request HTTP-message
Request-Line start-line, Request
Request-URI Request-Line
Response HTTP-message
Retry-After response-header
SP LWS, tspecials, unsafe, rfc1123-date, rfc1123-date, rfc1123-date, rfc850-date, rfc850-date, rfc850-date, asctime-date, asctime-date, asctime-date, date1, date1, date3, date3, Request-Line, Request-Line, Status-Line, Status-Line, challenge, basic-credentials, byte-content-range-spec, warning-value, warning-value, relationship
Server response-header
Status-Code Status-Line
Status-Line start-line, Response
TEXT password
Transfer-Encoding general-header
UPALPHA ALPHA
URI Link, link-param, URI-header
Upgrade general-header
User-Agent request-header
Vary response-header
Via general-header
WWW-Authenticate response-header
Warning response-header
abs_path relativeURI, net_path, http_URL, Request-URI
absoluteURI URI, Request-URI, Content-Base, Content-Location, Location, Referer
accept-extension accept-params
accept-params Accept
acceptable-ranges Accept-Ranges
age-value Age
asctime-date HTTP-date
attribute parameter
auth-param challenge, credentials
auth-scheme challenge, credentials
basic-cookie basic-credentials
basic-credentials credentials
byte-content-range-spec content-range-spec
byte-range-set byte-ranges-specifier
byte-range-spec byte-range-set
byte-ranges-specifier ranges-specifier
bytes-unit range-unit, byte-content-range-spec, byte-ranges-specifier
cache-directive Cache-Control
cache-extension cache-request-directive, cache-response-directive
cache-request-directive cache-directive
cache-response-directive cache-directive
challenge Proxy-Authenticate, WWW-Authenticate
charset Accept-Charset
chunk Chunked-Body
chunk-data chunk
chunk-ext chunk
chunk-ext-name chunk-ext
chunk-ext-value chunk-ext
chunk-size chunk, chunk-data
comment comment, Server, User-Agent, Via
connection-token Connection-header
content-coding Accept-Encoding, Content-Encoding
content-range-spec Content-Range
credentials Authorization, Proxy-Authorization
ctext comment
date1 rfc1123-date
date2 rfc850-date
date3 asctime-date
delta-seconds age-value, cache-request-directive, cache-request-directive, cache-request-directive, cache-response-directive, Retry-After
entity-body message-body
entity-header footer, Request, Response
entity-length byte-content-range-spec
entity-tag ETag, If-Match, If-None-Match, If-Range
escape uchar
extension-code Status-Code
extension-header entity-header
extension-method Method
extension-pragma pragma-directive
extra unreserved
field-content field-value
field-name message-header, cache-request-directive, cache-response-directive, cache-response-directive, Vary
field-value message-header
first-byte-pos byte-content-range-spec, byte-range-spec
footer Chunked-Body
fragment URI
fsegment path
general-header Request, Response
hex-no-zero chunk-size
host http_URL, Host, received-by, warn-agent
keepalive-param Keep-Alive-header
language-range Accept-Language
language-tag Content-Language
last-byte-pos byte-content-range-spec, byte-range-spec
link-extension link-param
link-param Link
mailbox From
md5-digest Content-MD5
media-range Accept
media-type Content-Type
message-body generic-message, Request, Response
message-header generic-message, extension-header
method Allow, Public
month date1, date2, date3
national unreserved
net_loc net_path
net_path relativeURI
opaque-tag entity-tag
other-range-unit range-unit
param params, params
param-name keepalive-param
parameter media-type, media-range
params rel_path
password user-pass
path rel_path
pchar fsegment, segment, param, net_loc
port http_URL, Host, received-by, warn-agent
pragma-directive Pragma
primary-tag language-tag
product Server, Upgrade, User-Agent
product-version product
protocol-name received-protocol
protocol-version received-protocol
pseudonym received-by, warn-agent
qdtext quoted-string
query rel_path
quoted-string chunk-ext-value, value, opaque-tag, auth-param, realm-value, accept-extension, cache-extension, extension-pragma, warn-text, Content-Version, Derived-From, link-param, link-extension
qvalue accept-params, Accept-Charset, Accept-Language
range-unit acceptable-ranges
ranges-specifier Range
realm challenge
realm-value realm
received-by Via
received-protocol Via
rel_path relativeURI, abs_path
relationship link-param, link-param
relativeURI URI, Content-Location, Referer
request-header Request
reserved absoluteURI, query, fragment
response-header Response
rfc1123-date HTTP-date
rfc850-date HTTP-date
safe unreserved
scheme absoluteURI
segment path
sgml-name relationship, relationship, relationship
start-line generic-message
subtag language-tag
subtype media-type, media-range
suffix-byte-range-spec byte-range-set
suffix-length suffix-byte-range-spec
time rfc1123-date, rfc850-date, asctime-date
token charset, content-coding, transfer-extension, chunk-ext-name, chunk-ext-value, type, subtype, attribute, value, product, product-version, other-range-unit, field-name, extension-method, auth-scheme, auth-param, accept-extension, accept-extension, cache-extension, cache-extension, connection-token, extension-pragma, extension-pragma, protocol-name, protocol-version, pseudonym, link-extension, link-extension
transfer-coding Transfer-Encoding
transfer-extension transfer-coding
type media-type, media-range, media-range
uchar absoluteURI, query, fragment, pchar
unreserved uchar
user-pass basic-cookie
userid user-pass
value parameter, keepalive-param
warn-agent warning-value
warn-code warning-value
warn-text warning-value
warning-value Warning
weak entity-tag
weekday rfc850-date
wkday rfc1123-date, asctime-date