github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

ry / libebb

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 47
    • 5
  • Source
  • Commits
  • Network (5)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: 6460653

click here to add a description

click here to add a homepage

  • Branches (2)
    • gnutls
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

a lightweight HTTP server library for C — Read more

  cancel

http://tinyclouds.org/libebb

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

bug fix, writing zero-length messages 
ry (author)
Sun Nov 09 22:59:13 -0800 2008
commit  646065359957956c9a0a611aa91ee79fb4928e6d
tree    608692cea9c09788dd8ac768bc126c1f5dfaedba
parent  b4855be330f52afb771ab63c44daf7a4b8c3c8b6
libebb / ebb_request_parser.h ebb_request_parser.h
100644 112 lines (99 sloc) 3.927 kb
edit raw blame history
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/* This file is part of the libebb web server library
*
* Copyright (c) 2008 Ryan Dahl (ry@ndahl.us)
* All rights reserved.
*
* This parser is based on code from Zed Shaw's Mongrel.
* Copyright (c) 2005 Zed A. Shaw
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ebb_request_parser_h
#define ebb_request_parser_h
 
#include <sys/types.h>
 
typedef struct ebb_request ebb_request;
typedef struct ebb_request_parser ebb_request_parser;
typedef void (*ebb_header_cb)(ebb_request*, const char *at, size_t length, int header_index);
typedef void (*ebb_element_cb)(ebb_request*, const char *at, size_t length);
 
#define EBB_MAX_MULTIPART_BOUNDARY_LEN 20
 
struct ebb_request {
  enum { EBB_COPY
       , EBB_DELETE
       , EBB_GET
       , EBB_HEAD
       , EBB_LOCK
       , EBB_MKCOL
       , EBB_MOVE
       , EBB_OPTIONS
       , EBB_POST
       , EBB_PROPFIND
       , EBB_PROPPATCH
       , EBB_PUT
       , EBB_TRACE
       , EBB_UNLOCK
       } method;
  
  enum { EBB_IDENTITY
       , EBB_CHUNKED
       } transfer_encoding; /* ro */
 
  size_t content_length; /* ro - 0 if unknown */
  size_t body_read; /* ro */
  int expect_continue; /* ro */
  unsigned int version_major; /* ro */
  unsigned int version_minor; /* ro */
  int number_of_headers; /* ro */
  int keep_alive; /* private - use ebb_request_should_keep_alive */
 
  char multipart_boundary[EBB_MAX_MULTIPART_BOUNDARY_LEN]; /* ro */
  unsigned int multipart_boundary_len; /* ro */
 
  /* Public - ordered list of callbacks */
  ebb_element_cb on_path;
  ebb_element_cb on_query_string;
  ebb_element_cb on_uri;
  ebb_element_cb on_fragment;
  ebb_header_cb on_header_field;
  ebb_header_cb on_header_value;
  void (*on_headers_complete)(ebb_request *);
  ebb_element_cb on_body;
  void (*on_complete)(ebb_request *);
  void *data;
};
 
struct ebb_request_parser {
  int cs; /* private */
  size_t chunk_size; /* private */
  unsigned eating:1; /* private */
  ebb_request *current_request; /* ro */
  const char *header_field_mark;
  const char *header_value_mark;
  const char *query_string_mark;
  const char *path_mark;
  const char *uri_mark;
  const char *fragment_mark;
 
  /* Public */
  ebb_request* (*new_request)(void*);
  void *data;
};
 
void ebb_request_parser_init(ebb_request_parser *parser);
size_t ebb_request_parser_execute(ebb_request_parser *parser, const char *data, size_t len);
int ebb_request_parser_has_error(ebb_request_parser *parser);
int ebb_request_parser_is_finished(ebb_request_parser *parser);
void ebb_request_init(ebb_request *);
int ebb_request_should_keep_alive(ebb_request *request);
#define ebb_request_has_body(request) \
(request->transfer_encoding == EBB_CHUNKED || request->content_length > 0 )
 
#endif
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server