Skip to content

Commit

Permalink
clean ups for c++ inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 22, 2009
1 parent f410928 commit a919b9a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GNUTLSFLAGS = -DHAVE_GNUTLS

# includes and libs
INCS = -I${EVINC} -I${GNUTLSINC}
LIBS = ${EVLIBS} ${GNUTLSLIBS}
LIBS = ${EVLIBS} ${GNUTLSLIBS} -lefence

# flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" ${GNUTLSFLAGS}
Expand Down
24 changes: 14 additions & 10 deletions ebb_request_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
*/
#ifndef ebb_request_parser_h
#define ebb_request_parser_h
#ifdef __cplusplus
extern "C" {
#endif


#include <sys/types.h>

Expand All @@ -53,23 +57,20 @@ typedef void (*ebb_element_cb)(ebb_request*, const char *at, size_t length);
#define EBB_TRACE 0x00001000
#define EBB_UNLOCK 0x00002000

/* Transfer Encodings */
#define EBB_IDENTITY 0x00000001
#define EBB_CHUNKED 0x00000002

struct ebb_request {
int method;

enum { EBB_IDENTITY
, EBB_CHUNKED
} transfer_encoding; /* ro */

size_t content_length; /* ro - 0 if unknown */
size_t body_read; /* ro */
int transfer_encoding; /* 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 */
size_t content_length; /* ro - 0 if unknown */
size_t body_read; /* ro */

/* Public - ordered list of callbacks */
ebb_element_cb on_path;
Expand Down Expand Up @@ -110,4 +111,7 @@ int ebb_request_should_keep_alive(ebb_request *request);
#define ebb_request_has_body(request) \
(request->transfer_encoding == EBB_CHUNKED || request->content_length > 0 )

#ifdef __cplusplus
}
#endif
#endif
13 changes: 0 additions & 13 deletions ebb_request_parser.rl
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,6 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
action set_keep_alive { CURRENT->keep_alive = TRUE; }
action set_not_keep_alive { CURRENT->keep_alive = FALSE; }

action multipart_boundary {
if(CURRENT->multipart_boundary_len == EBB_MAX_MULTIPART_BOUNDARY_LEN) {
cs = -1;
fbreak;
}
CURRENT->multipart_boundary[CURRENT->multipart_boundary_len++] = *p;
}

action expect_continue {
CURRENT->expect_continue = TRUE;
}
Expand Down Expand Up @@ -268,10 +260,6 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
| "close"i %set_not_keep_alive
)
)
# | ("Content-Type"i hsep
# "multipart/form-data" any*
# "boundary=" quote token+ $multipart_boundary quote
# )
| ("Transfer-Encoding"i %use_chunked_encoding hsep "identity" %use_identity_encoding)
# | ("Expect"i hsep "100-continue"i %expect_continue)
# | ("Trailer"i hsep field_value %trailer)
Expand Down Expand Up @@ -398,7 +386,6 @@ void ebb_request_init(ebb_request *request)
request->version_minor = 0;
request->number_of_headers = 0;
request->transfer_encoding = EBB_IDENTITY;
request->multipart_boundary_len = 0;
request->keep_alive = -1;

request->on_complete = NULL;
Expand Down
1 change: 1 addition & 0 deletions test_request_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ ebb_request* new_request ()
r->on_fragment = fragment_cb;
r->on_query_string = query_string_cb;
r->on_body = body_handler;
r->on_headers_complete = NULL;

r->data = &requests[num_requests];
// printf("new request %d\n", num_requests);
Expand Down

0 comments on commit a919b9a

Please sign in to comment.