Annotation of parser3/src/include/pa_request_info.h, revision 1.22
1.2 paf 1: /** @file
2: Parser: request info class decl.
3:
1.20 moko 4: Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.18 moko 5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.2 paf 6: */
7:
8: #ifndef PA_REQUEST_INFO_H
9: #define PA_REQUEST_INFO_H
10:
1.22 ! moko 11: #define IDENT_PA_REQUEST_INFO_H "$Id: pa_request_info.h,v 1.21 2026/09/30 16:44:20 moko Exp $"
1.17 moko 12:
13: // include
14:
15: #include "pa_config_includes.h"
1.2 paf 16:
17: /// some information from web server
18: class Request_info {
19: public:
20: //@{ these filled by Request class user
21: const char* document_root;
1.22 ! moko 22: const char* document_root_path; // '/'-normalized, without the trailing '/'
! 23: const char* path_translated; // '/'-normalized disk path of the requested file
1.2 paf 24: const char* method;
25: const char* query_string;
26: const char* uri;
27: const char* content_type;
28: size_t content_length;
29: const char* cookie;
1.6 misha 30:
31: char** argv;
1.2 paf 32: bool mail_received;
33: //@}
34: //@{ these are filed by Request class itself: user's post data
35: const char* post_data; size_t post_size;
36: //@}
1.8 misha 37:
1.13 moko 38: // see feature #1116 for details
1.8 misha 39: bool can_have_body(){
40: return
41: method
1.13 moko 42: && strcasecmp(method, "GET") != 0
43: && strcasecmp(method, "HEAD") != 0
44: && strcasecmp(method, "TRACE") != 0;
1.8 misha 45: }
1.10 moko 46:
1.11 moko 47: static const char* strip_absolute_uri(const char *auri){
1.12 moko 48: if(!auri || *auri == '/')
1.10 moko 49: return auri;
50:
51: // extractring https?://site.name prefix allowed by http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
52:
53: if(!pa_strncasecmp(auri, "http://"))
54: auri+=7;
55: else if(!pa_strncasecmp(auri, "https://"))
56: auri+=8;
57: else
58: return auri;
59: for(; *auri && *auri != '/'; auri++);
60: return auri;
61: }
1.17 moko 62:
1.21 moko 63: void set_document_root(const char* adocument_root);
64:
1.17 moko 65: Request_info() {
66: memset(this, 0, sizeof(*this)); // OK as Request_info is POD
67: }
1.2 paf 68: };
69:
70: #endif
E-mail: