Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

reqhandler_file.c File Reference

pdeppd's requesthandler for files. More...

#include "common.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "reqhandler_file.h"
#include "buffer.h"
#include "conftable.h"
#include "http.h"
#include "logger.h"
#include "mime.h"
#include "misc.h"
#include "xmalloc.h"

Include dependency graph for reqhandler_file.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  ReqHandlerFile

Defines

#define ALLOW   "GET HEAD"
 hard coded allow: the server will not support smth else!


Functions

int getAbsPath (char **abs_path, const char *path)
 converts path to an absolute path abs_path (if possible). More...

int getSrcInfo (ReqHandlerFile this)
 puts some information to this. More...

int rhfModulePreInit ()
 initialize / calculate static values. More...

int rhfModuleTerminate ()
 free all static ressourcesallocated. More...

ReqHandlerFile rhfInit (HttpProtHandler parent, const char *path_buf, int change_path)
 creates, initializes and returns a file-request Handler. More...

int rhfReceive (ReqHandlerFile this, struct Buffer *buf)
 recieve some data... NOT IMPLEMENTED (only useful for POST). More...

int rhfSend (ReqHandlerFile this, struct Buffer **buf)
 orders a ProtHandler to send buffered data. More...

int rhfProcess (ReqHandlerFile this)
 process some data. More...

int rhfIsDataPending (ReqHandlerFile this)
 checks if data is pending. More...

int rhfTerminate (ReqHandlerFile this)
 terminates this. More...

int rhfGetError (ReqHandlerFile this)
 returns the error of this. More...

size_t rhfGetSourceSize (ReqHandlerFile this)
 returns the file size of the requested file. More...

time_t rhfGetModTime (ReqHandlerFile this)
 returns the files modification date. More...

const char * rhfGetAllow (ReqHandlerFile this)
 returns the allows connected to the file. More...

const char * rhfGetContentType (ReqHandlerFile this)
 returns the files extension. More...


Detailed Description

pdeppd's requesthandler for files.

Definition in file reqhandler_file.c.


Function Documentation

int getAbsPath char **    abs_path,
const char *    path
 

converts path to an absolute path abs_path (if possible).

Parameters:
abspath  contains the absolute path, after conversion
path  the path to be converted into an absolute path
converts path into an absolute path abs_path, by combining rootdir and path and then convert it into a valid path

Returns:
0 on success, -1 otherwise

Definition at line 278 of file reqhandler_file.c.

Referenced by rhfInit().

int getSrcInfo ReqHandlerFile    this
 

puts some information to this.

Parameters:
this  the data containing the file information
reads the source size, the modification date and the extension from the file contained in this

Returns:
0 on success, -1 otherwise

Definition at line 372 of file reqhandler_file.c.

Referenced by rhfInit().

const char* rhfGetAllow ReqHandlerFile    this
 

returns the allows connected to the file.

Parameters:
this  the struct to be manipulated
Returns:
the allows

Definition at line 251 of file reqhandler_file.c.

const char* rhfGetContentType ReqHandlerFile    this
 

returns the files extension.

Parameters:
this  the struct to be manipulated
Returns:
the extension, or the file itselfe, if no extension is found

Definition at line 257 of file reqhandler_file.c.

int rhfGetError ReqHandlerFile    this
 

returns the error of this.

Parameters:
this  the struct to be manipulated
Returns:
error of this

Definition at line 233 of file reqhandler_file.c.

time_t rhfGetModTime ReqHandlerFile    this
 

returns the files modification date.

Parameters:
this  the struct to be manipulated
Returns:
the modification date of the file

Definition at line 246 of file reqhandler_file.c.

size_t rhfGetSourceSize ReqHandlerFile    this
 

returns the file size of the requested file.

Parameters:
this  the struct to be manipulated
Returns:
the size of the file

Definition at line 241 of file reqhandler_file.c.

ReqHandlerFile rhfInit HttpProtHandler    parent,
const char *    path_buf,
int    change_path
 

creates, initializes and returns a file-request Handler.

Parameters:
parent  Parent ie. caller
path_buf  the path of the file (absolute or relative)
change_path  if true the path ist converted into an absolute path (/../ is removed), else the path is take as it is
rhfInit initialises some std. values and resets data. It also opens a filehandler to be used later. If an error occures, or the file doesnt exist, error is set to the errorcode.

Returns:
an initialized file-requesthandler

Definition at line 110 of file reqhandler_file.c.

int rhfIsDataPending ReqHandlerFile    this
 

checks if data is pending.

Parameters:
this  the struct containing data information
Returns:
true if data pending, else false

Definition at line 212 of file reqhandler_file.c.

int rhfModulePreInit  
 

initialize / calculate static values.

Returns:
0 on success, -1 on failure

Definition at line 87 of file reqhandler_file.c.

int rhfModuleTerminate  
 

free all static ressourcesallocated.

Returns:
0 on success, -1 on failure

Definition at line 102 of file reqhandler_file.c.

int rhfProcess ReqHandlerFile    this
 

process some data.

Parameters:
this  the struct containing data information
gives this the chance to do some internal work. NOTHING IMPLEMENTED NOW

Returns:
0 on success, -1 on error (error of this is set to concrete error)

Definition at line 207 of file reqhandler_file.c.

int rhfReceive ReqHandlerFile    this,
struct Buffer   buf
 

recieve some data... NOT IMPLEMENTED (only useful for POST).

Parameters:
this  the struct to be manipulated
str  the string containing the data to be recieved
rhfRecieve has to be understood as rhfRecieve!, because it is a call to do so. NOTHING IMPLEMENTED NOW (function unused)!

Returns:
0 on success, -1 if any error occured (error of this is set to concrete error)

Definition at line 166 of file reqhandler_file.c.

int rhfSend ReqHandlerFile    this,
struct Buffer **    buf
 

orders a ProtHandler to send buffered data.

Parameters:
this  the struct containing data information
buf  the buffer (pnter), in which the data will be stored
rhfSend has to be understood as rhfSend!, because it is a call to do so. If data is waiting, it will be stored in buf, else (*buf)->data is set to NULL.

Returns:
0 on success, -1 on error (error of this is set to concrete error)

Definition at line 172 of file reqhandler_file.c.

int rhfTerminate ReqHandlerFile    this
 

terminates this.

Parameters:
this  the struct to be terminated
terminates this and frees all allocated memory used by this.

Returns:
0 on success, -1 on error (error of this is set to concrete error)

Definition at line 217 of file reqhandler_file.c.


Generated on Fri Jan 25 22:40:59 2002 for PDepp Webserver by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001