Annotation of parser3/src/include/pa_http.h, revision 1.19

1.1       paf         1: /** @file
                      2:        Parser: commonly used functions.
                      3: 
1.19    ! moko        4:        Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com)
1.1       paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
                      6: */
                      7: 
                      8: #ifndef PA_HTTP_H
                      9: #define PA_HTTP_H
                     10: 
1.19    ! moko       11: #define IDENT_PA_HTTP_H "$Id: pa_http.h,v 1.18 2017/01/23 09:33:02 moko Exp $"
1.1       paf        12: 
                     13: #include "pa_vstring.h"
                     14: #include "pa_vint.h"
                     15: #include "pa_vhash.h"
                     16: #include "pa_vtable.h"
                     17: #include "pa_socks.h"
1.15      moko       18: #include "pa_charset.h"
1.10      misha      19: #include "pa_request.h"
1.1       paf        20: 
1.11      misha      21: #define HTTP_COOKIES_NAME "cookies"
1.12      moko       22: 
1.1       paf        23: #ifndef DOXYGEN
                     24: struct File_read_http_result {
                     25:        char *str; size_t length;
                     26:        HashStringValue* headers;
                     27: }; 
                     28: #endif
                     29: 
1.15      moko       30: class ResponseHeaders {
                     31: public:
                     32:        class Header {
                     33:        public:
                     34:                String::Body name;
                     35:                String::Body value;
                     36: 
                     37:                Header(String::Body aname, String::Body avalue) : name(aname), value(avalue) {}
                     38: 
                     39:                void transcode(Charset &charset, Charset &source){
                     40:                        name=Charset::transcode(name, charset, source);
                     41:                        value=Charset::transcode(value, charset, source);
                     42:                }
                     43: 
                     44:        };
                     45: 
                     46:        Array<Header> headers;
                     47: 
                     48:        String::Body content_type;
1.18      moko       49:        uint64_t content_length;
1.15      moko       50: 
1.18      moko       51:        ResponseHeaders() : content_type(""), content_length(0){}
1.15      moko       52: 
1.18      moko       53:        bool add_header(const char *line);
1.15      moko       54: 
1.17      moko       55:        void clear(){
                     56:                headers.clear();
                     57:                content_type="";
1.18      moko       58:                content_length=0;
1.17      moko       59:        }
                     60: 
1.15      moko       61: };
                     62: 
1.9       misha      63: Table* parse_cookies(Request& r, Table *cookies);
1.16      moko       64: void tables_update(HashStringValue& tables, const String::Body name, const String& value);
1.9       misha      65: 
1.6       moko       66: char *pa_http_safe_header_name(const char *name);
                     67: 
1.15      moko       68: File_read_http_result pa_internal_file_read_http(Request& r, const String& file_spec, bool as_text, HashStringValue *options=0, bool transcode_text_result=true);
1.1       paf        69: 
                     70: #endif

E-mail: