Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit c33f2be

Browse files
committed
Add primary header with initial API draft.
1 parent f12bde9 commit c33f2be

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

http.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef http_h
2+
#define http_h
3+
4+
typedef struct http_context_s http_context;
5+
typedef struct http_session_s http_session;
6+
typedef struct http_request_s http_request;
7+
8+
/*
9+
* A Context is bound to a collection of sessions and
10+
* ongoing requests. Each thread in a process should have its
11+
* own Context to avoid deadlocks and conflicts.
12+
*/
13+
http_context* http_context_create();
14+
void http_context_release(http_context* ctx);
15+
16+
/*
17+
* A session represents an active communication line to a server.
18+
* One or more network sockets may be open to the server to
19+
* fulfill requests. Pipelining will be used if supported by server.
20+
*/
21+
http_session* http_session_open(http_context* ctx, const char* host, int port);
22+
void http_session_close(http_session* session);
23+
24+
http_request* http_request_create(http_session* session, const char* path, http_method method);
25+
http_request* http_request_get(http_session* session, const char* path);
26+
http_request* http_request_post(http_session* session, const char* path);
27+
28+
#endif

0 commit comments

Comments
 (0)