37 #define MIN(a,b) ((a)<(b)? (a) : (b))
43 HttpParser
this = _this;
50 if (
FALSE == this->ourLock)
58 if (NULL != this->incomplete) {
59 cbufSetData(this->buffer, this->incomplete, this->isize);
63 if (0 > (read =
cbufRead(this->buffer, st))) {
65 this->ourLock =
FALSE;
78 this->ourLock =
FALSE;
84 if (NULL == (line =
cbufGetLine(this->buffer, &line_end))) {
86 this->isize = this->buffer->bused;
87 this->incomplete =
memMalloc(this->isize);
88 memcpy(this->incomplete,
93 this->ourLock =
FALSE;
99 if (NULL == this->current) {
101 this->ourLock =
FALSE;
109 if (NULL == (line =
cbufGetLine(this->buffer, &line_end))) {
111 this->isize = this->buffer->bused;
112 this->incomplete =
memMalloc(this->isize);
113 memcpy(this->incomplete,
118 this->ourLock =
FALSE;
123 if (0 != strlen(line)) {
131 if (this->current->dbody == this->current->nbody) {
136 this->ourLock =
FALSE;
146 this->buffer->bused));
154 this->current->header,
155 CSTRA(
"content-type"));
160 if (NULL != enc && 0 == strncasecmp(
161 "application/x-www-form-urlencoded",
163 MIN(
sizeof(
"application/x-www-form-urlencoded")-1,
172 queuePut(this->queue, this->current);
173 this->current = NULL;
187 return this->queue->nmsg;
char cbufIsEmpty(Cbuf this)
char * cbufGetData(Cbuf, size_t)
void httpParserRequestVars(HttpParser)
char * cbufSetData(Cbuf, const void *, size_t)
void cbufRelease(Cbuf this)
#define CSTRA(val)
Const STRing Argument.
Bool cbufIsLocked(Cbuf this)
void * hashGet(Hash, const char *, size_t)
void queuePut(Queue, void *)
void httpParserNewMessage(HttpParser, const char *, const char *lend)
ssize_t cbufRead(Cbuf, Stream)
char * cbufGetLine(Cbuf, char **)
void httpParserHeader(HttpParser, const char *, const char *)
void httpParserPostVars(HttpParser)
ssize_t httpParserParse(void *_this, Stream st)
size_t httpParserBody(HttpParser, const char *, size_t)
void cbufIncRead(Cbuf this, size_t n)
char * cbufGetRead(Cbuf this)
void cbufSkipNonAlpha(Cbuf this)