Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cf58019f2a
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (29 sloc) 0.923 kb
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 27 28 29 30 31 32 33 34 35
#ifndef picohttpparser_h
#define picohttpparser_h

#ifdef __cplusplus
extern "C" {
#endif

/* contains name and value of a header (name == NULL if is a continuing line
* of a multiline header */
struct phr_header {
  const char* name;
  size_t name_len;
  const char* value;
  size_t value_len;
};

/* returns number of bytes cosumed if successful, -2 if request is partial,
* -1 if failed */
int phr_parse_request(const char* buf, size_t len, const char** method,
size_t* method_len, const char** path,
size_t* path_len, int* minor_version,
struct phr_header* headers, size_t* num_headers,
size_t last_len);

/* ditto */
int phr_parse_response(const char* _buf, size_t len, int *minor_version,
              int *status, const char **msg, size_t *msg_len,
              struct phr_header* headers, size_t* num_headers,
              size_t last_len);

#ifdef __cplusplus
}
#endif

#endif
Something went wrong with that request. Please try again.