You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#include "http/request/parser.h"
|
|
|
|
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
|
#define _BSIZE(x) (MAX((x),RESPONSE_WRITER_MAX_BUF))
|
|
#define BSIZE _BSIZE(this->nheader+message->nbody)
|
|
|
|
|
|
/**
|
|
* @deprecated
|
|
*/
|
|
ssize_t
|
|
httpRequestParserRead(HttpRequestParser this, int fd)
|
|
{
|
|
/**
|
|
* @obsolete
|
|
*/
|
|
return -1;
|
|
// size_t remaining, chunks;
|
|
// char buffer[1024];
|
|
//
|
|
// ssize_t size = read(fd, buffer, 1024);
|
|
//
|
|
// if (0 < size) {
|
|
// remaining = this->buffer_used % HTTP_REQUEST_PARSER_READ_CHUNK;
|
|
// remaining = HTTP_REQUEST_PARSER_READ_CHUNK - remaining;
|
|
// chunks = this->buffer_used / HTTP_REQUEST_PARSER_READ_CHUNK;
|
|
//
|
|
// /**
|
|
// * because a division always rounds down
|
|
// * chunks holds exactly the currently allocated chunks if
|
|
// * remaining equals 0 but there is no space left.
|
|
// * Else chunks holds the actually allocated amount of chunks
|
|
// * minus 1.
|
|
// * For this reason chunks always has to be increased by 1.
|
|
// */
|
|
// chunks++;
|
|
//
|
|
// if (size >= remaining) {
|
|
// this->buffer =
|
|
// realloc(this->buffer, chunks * HTTP_REQUEST_PARSER_READ_CHUNK);
|
|
// }
|
|
//
|
|
// memcpy(this->buffer + this->buffer_used, buffer, size);
|
|
// this->buffer_used += size;
|
|
// this->buffer[this->buffer_used] = 0;
|
|
//
|
|
// size = httpRequestParserParse(this);
|
|
// }
|
|
// else {
|
|
// size = (0 == size)? -2 : size;
|
|
// }
|
|
//
|
|
// return size;
|
|
}
|
|
|
|
// vim: set ts=4 sw=4:
|