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

1.2       paf         1: /** @file
                      2:        Parser: request info class decl.
                      3: 
1.9       moko        4:        Copyright (c) 2001-2015 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.13    ! moko       11: #define IDENT_PA_REQUEST_INFO_H "$Id: pa_request_info.h,v 1.12 2016/11/25 23:37:06 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;
                     27:        int args_skip;
1.2       paf        28:        bool mail_received;
                     29:        //@}
                     30:        //@{ these are filed by Request class itself: user's post data
                     31:        const char* post_data;  size_t post_size;
                     32:        //@}
1.8       misha      33: 
1.13    ! moko       34:        // see feature #1116 for details
1.8       misha      35:        bool can_have_body(){
                     36:                return
                     37:                        method
1.13    ! moko       38:                        && strcasecmp(method, "GET") != 0
        !            39:                        && strcasecmp(method, "HEAD") != 0
        !            40:                        && strcasecmp(method, "TRACE") != 0;
1.8       misha      41:        }
1.10      moko       42: 
1.11      moko       43:        static const char* strip_absolute_uri(const char *auri){
1.12      moko       44:                if(!auri || *auri == '/')
1.10      moko       45:                        return auri;
                     46: 
                     47:                // extractring https?://site.name prefix allowed by http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
                     48: 
                     49:                if(!pa_strncasecmp(auri, "http://"))
                     50:                        auri+=7;
                     51:                else if(!pa_strncasecmp(auri, "https://"))
                     52:                        auri+=8;
                     53:                else
                     54:                        return auri;
                     55:                for(; *auri && *auri != '/'; auri++);
                     56:                return auri;
                     57:        }
1.2       paf        58: };
                     59: 
                     60: #endif

E-mail: