summaryrefslogtreecommitdiffstats
path: root/fastlib/src/vespa/fastlib/net/httpheaderparser.h
blob: 94f6bccbdb4d43042f8b6b8c2c98f481d62675e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <cstddef>

class Fast_BufferedInputStream;

class Fast_HTTPHeaderParser
{
public:
    Fast_HTTPHeaderParser(const Fast_HTTPHeaderParser &) = delete;
    Fast_HTTPHeaderParser & operator = (const Fast_HTTPHeaderParser &) = delete;
    Fast_HTTPHeaderParser(Fast_BufferedInputStream &in);
    ~Fast_HTTPHeaderParser();

    // Methods
    bool ReadRequestLine(const char *&method, const char *&url, int &versionMajor, int &versionMinor);
    bool ReadHeader(const char *&name, const char *&value);
private:
    char                      _pushBack;
    bool                      _isPushBacked;
    const size_t              _bufferSize;
    char                     *_lineBuffer;
    Fast_BufferedInputStream *_input;
};