Annotation of parser3/src/include/pa_request_info.h, revision 1.15

1.2       paf         1: /** @file
                      2:        Parser: request info class decl.
                      3: 
1.14      moko        4:        Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
1.2       paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
                      6: */
                      7: 
                      8: #ifndef PA_REQUEST_INFO_H
                      9: #define PA_REQUEST_INFO_H
                     10: 
1.15    ! moko       11: #define IDENT_PA_REQUEST_INFO_H "$Id: pa_request_info.h,v 1.14 2017/02/07 22:00:36 moko Exp $"
1.2       paf        12: 
                     13: /// some information from web server
                     14: class Request_info {
                     15: public:
                     16:        //@{ these filled by Request class user
                     17:        const char* document_root;
                     18:        const char* path_translated;
                     19:        const char* method;
                     20:        const char* query_string;
                     21:        const char* uri;
                     22:        const char* content_type;
                     23:        size_t content_length;
                     24:        const char* cookie;
1.6       misha      25:        
                     26:        char** argv;
1.2       paf        27:        bool mail_received;
                     28:        //@}
                     29:        //@{ these are filed by Request class itself: user's post data
                     30:        const char* post_data;  size_t post_size;
                     31:        //@}
1.8       misha      32: 
1.13      moko       33:        // see feature #1116 for details
1.8       misha      34:        bool can_have_body(){
                     35:                return
                     36:                        method
1.13      moko       37:                        && strcasecmp(method, "GET") != 0
                     38:                        && strcasecmp(method, "HEAD") != 0
                     39:                        && strcasecmp(method, "TRACE") != 0;
1.8       misha      40:        }
1.10      moko       41: 
1.11      moko       42:        static const char* strip_absolute_uri(const char *auri){
1.12      moko       43:                if(!auri || *auri == '/')
1.10      moko       44:                        return auri;
                     45: 
                     46:                // extractring https?://site.name prefix allowed by http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
                     47: 
                     48:                if(!pa_strncasecmp(auri, "http://"))
                     49:                        auri+=7;
                     50:                else if(!pa_strncasecmp(auri, "https://"))
                     51:                        auri+=8;
                     52:                else
                     53:                        return auri;
                     54:                for(; *auri && *auri != '/'; auri++);
                     55:                return auri;
                     56:        }
1.2       paf        57: };
                     58: 
                     59: #endif

E-mail: