Browse Source

remove message type (PIPED|BUFFERD) because when I use mmap for file io I will always have a memory address, so its kind of buffered.

release0.1.5
Georg Hopp 12 years ago
parent
commit
acf4516b12
  1. 8
      include/http/message.h
  2. 9
      include/http/response.h
  3. 1
      src/http/response/304.c
  4. 1
      src/http/response/403.c
  5. 1
      src/http/response/404.c
  6. 2
      src/http/response/login_form.c
  7. 2
      src/http/response/randval.c
  8. 2
      src/http/response/session.c

8
include/http/message.h

@ -28,19 +28,11 @@
#include "hash.h" #include "hash.h"
#include "stream.h" #include "stream.h"
typedef enum e_HttpMessageType {
HTTP_MESSAGE_BUFFERED=0,
HTTP_MESSAGE_PIPED
} HttpMessageType;
CLASS(HttpMessage) { CLASS(HttpMessage) {
char * version; char * version;
Hash header; Hash header;
HttpMessageType type;
Stream handle;
char * body; char * body;
int nbody; int nbody;
int dbody; int dbody;

9
include/http/response.h

@ -30,6 +30,7 @@
#include "class.h" #include "class.h"
#include "http/message.h" #include "http/message.h"
#include "session.h" #include "session.h"
#include "asset.h"
CLASS(HttpResponse) { CLASS(HttpResponse) {
@ -43,16 +44,14 @@ HttpResponse httpResponse304(
const char *, size_t, const char *, size_t,
const char *, size_t, const char *, size_t,
const char *, size_t); const char *, size_t);
HttpResponse httpResponse404();
HttpResponse httpResponse403(); HttpResponse httpResponse403();
HttpResponse httpResponse404();
HttpResponse httpResponse500();
HttpResponse httpResponseMe(); HttpResponse httpResponseMe();
HttpResponse httpResponseLoginForm(); HttpResponse httpResponseLoginForm();
HttpResponse httpResponseRandval(time_t, int); HttpResponse httpResponseRandval(time_t, int);
HttpResponse httpResponseSession(Session); HttpResponse httpResponseSession(Session);
HttpResponse httpResponseAsset(
const char *,
const char *, size_t,
const char *, size_t);
HttpResponse httpResponseAsset(Asset);
#endif // __HTTP_RESPONSE_H__ #endif // __HTTP_RESPONSE_H__

1
src/http/response/304.c

@ -43,7 +43,6 @@ httpResponse304(
response = new(HttpResponse, "HTTP/1.1", 304, "Not Modified"); response = new(HttpResponse, "HTTP/1.1", 304, "Not Modified");
message = (HttpMessage)response; message = (HttpMessage)response;
message->type = HTTP_MESSAGE_BUFFERED;
message->nbody = 0; message->nbody = 0;
message->body = NULL; message->body = NULL;

1
src/http/response/403.c

@ -41,7 +41,6 @@ httpResponse403()
response = new(HttpResponse, "HTTP/1.1", 403, "Forbidden"); response = new(HttpResponse, "HTTP/1.1", 403, "Forbidden");
message = (HttpMessage)response; message = (HttpMessage)response;
message->type = HTTP_MESSAGE_BUFFERED;
message->nbody = 0; message->nbody = 0;
message->body = NULL; message->body = NULL;

1
src/http/response/404.c

@ -55,7 +55,6 @@ httpResponse404()
hashAdd(message->header, hashAdd(message->header,
new(HttpHeader, CSTRA("Content-Type"), CSTRA("text/html"))); new(HttpHeader, CSTRA("Content-Type"), CSTRA("text/html")));
message->type = HTTP_MESSAGE_BUFFERED;
message->nbody = sizeof(RESP_DATA) - 1; message->nbody = sizeof(RESP_DATA) - 1;
message->body = memMalloc(sizeof(RESP_DATA)); message->body = memMalloc(sizeof(RESP_DATA));
memcpy(message->body, RESP_DATA, sizeof(RESP_DATA)); memcpy(message->body, RESP_DATA, sizeof(RESP_DATA));

2
src/http/response/login_form.c

@ -52,8 +52,6 @@ httpResponseLoginForm()
hashAdd(message->header, hashAdd(message->header,
new(HttpHeader, CSTRA("Content-Type"), CSTRA("text/html"))); new(HttpHeader, CSTRA("Content-Type"), CSTRA("text/html")));
message->type = HTTP_MESSAGE_BUFFERED;
message->nbody = sizeof(RESP_DATA)-1; message->nbody = sizeof(RESP_DATA)-1;
message->body = memMalloc(message->nbody); message->body = memMalloc(message->nbody);
memcpy(message->body, RESP_DATA, message->nbody); memcpy(message->body, RESP_DATA, message->nbody);

2
src/http/response/randval.c

@ -52,8 +52,6 @@ httpResponseRandval(time_t ctime, int value)
hashAdd(message->header, hashAdd(message->header,
new(HttpHeader, CSTRA("Content-Type"), CSTRA("application/json"))); new(HttpHeader, CSTRA("Content-Type"), CSTRA("application/json")));
message->type = HTTP_MESSAGE_BUFFERED;
remaining = 10 - (time(NULL) - ctime); remaining = 10 - (time(NULL) - ctime);
nbuf = sprintf(buffer, RESP_DATA, ctime, remaining, value); nbuf = sprintf(buffer, RESP_DATA, ctime, remaining, value);

2
src/http/response/session.c

@ -52,8 +52,6 @@ httpResponseSession(Session session)
hashAdd(message->header, hashAdd(message->header,
new(HttpHeader, CSTRA("Content-Type"), CSTRA("application/json"))); new(HttpHeader, CSTRA("Content-Type"), CSTRA("application/json")));
message->type = HTTP_MESSAGE_BUFFERED;
nbuf = sprintf(buffer, RESP_DATA, nbuf = sprintf(buffer, RESP_DATA,
(NULL != session)? session->id : 0, (NULL != session)? session->id : 0,
(NULL != session)? SESSION_LIVETIME : 0, (NULL != session)? SESSION_LIVETIME : 0,

Loading…
Cancel
Save