doubango/trunk/tinyHTTP/ragel/thttp_machine_header.rl

81 lines
5.0 KiB
Ragel

/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@yahoo.fr>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
*/
/**@file thttp_machine_headers.rl.
* @brief Ragel file.
*
* @author Mamadou Diop <diopmamadou(at)yahoo.fr>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
/*== Header pasrsing machine. Supports both full-length and compact mode. */
%%{
machine thttp_machine_header;
Accept = "Accept"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Accept;
Accept_Charset = "Accept-Charset"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Accept_Charset;
Accept_Encoding = "Accept-Encoding"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Accept_Encoding;
Accept_Language = "Accept-Language"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Accept_Language;
Allow = "Allow"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Allow;
Authorization = "Authorization"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Authorization;
Cache_Control = "Cache-Control"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Cache_Control;
Connection = "Connection"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Connection;
Content_Encoding = ("Content-Encoding"i | "e") SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Encoding;
Content_Language = "Content-Language"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Language;
Content_Length = "Content-Length"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Length;
Content_Location = "Content-Location"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Location;
Content_MD5 = "Content-MD5"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_MD5;
Content_Range = "Content-Range"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Range;
Content_Type = ("Content-Type"i | "c") SP* HCOLON SP*<: any* :>CRLF @parse_header_Content_Type;
Date = "Date"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Date;
Expect = "Expect"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Expect;
Expires = "Expires"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Expires;
From = "From"i SP* HCOLON SP*<: any* :>CRLF @parse_header_From;
Host = "Host"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Host;
If_Match = "If-Match"i SP* HCOLON SP*<: any* :>CRLF @parse_header_If_Match;
If_Modified_Since = "If-Modified-Since"i SP* HCOLON SP*<: any* :>CRLF @parse_header_If_Modified_Since;
If_None_Match = "If-None-Match"i SP* HCOLON SP*<: any* :>CRLF @parse_header_If_None_Match;
If_Range = "If-Range"i SP* HCOLON SP*<: any* :>CRLF @parse_header_If_Range;
If_Unmodified_Since = "If-Unmodified-Since"i SP* HCOLON SP*<: any* :>CRLF @parse_header_If_Unmodified_Since;
Last_Modified = "Last-Modified"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Last_Modified;
Max_Forwards = "Max-Forwards"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Max_Forwards;
Pragma = "Pragma"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Pragma;
Proxy_Authorization = "Proxy-Authorization"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Proxy_Authorization;
Range = "Range"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Range;
Referer = "Referer"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Referer;
Transfer_Encoding = "Transfer-Encoding"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Transfer_Encoding;
TE = "TE"i SP* HCOLON SP*<: any* :>CRLF @parse_header_TE;
Trailer = "Trailer"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Trailer;
Upgrade = "Upgrade"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Upgrade;
User_Agent = "User-Agent"i SP* HCOLON SP*<: any* :>CRLF @parse_header_User_Agent;
Via = "Via"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Via;
Warning = "Warning"i SP* HCOLON SP*<: any* :>CRLF @parse_header_Warning;
######
extension_header = (token) SP* HCOLON SP*<: any* :>CRLF @parse_header_extension_header;
general_header = Cache_Control | Connection | Date | Pragma | Trailer | Transfer_Encoding | Upgrade | Via | Warning;
request_header = Accept | Accept_Charset | Accept_Encoding | Accept_Language | Authorization | Expect | From | Host | If_Match | If_Modified_Since | If_None_Match | If_Range | If_Unmodified_Since | Max_Forwards | Proxy_Authorization | Range | Referer | TE | User_Agent;
entity_header = Allow | Content_Encoding | Content_Language | Content_Length | Content_Location | Content_MD5 | Content_Range | Content_Type | Expires | Last_Modified;
HEADER = (general_header | request_header | entity_header)@1 | extension_header@0;
}%%