You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(38) |
Sep
(134) |
Oct
(30) |
Nov
(8) |
Dec
(17) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
(14) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
|
2009 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gonzalo A. <ga...@us...> - 2007-03-08 17:42:04
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7222/src Modified Files: Profiling.cpp Log Message: Wrote void show_profile_function(ProfileFunction*): writes the function name being profiled to stderr. Index: Profiling.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Profiling.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Profiling.cpp 12 Oct 2006 21:10:36 -0000 1.6 --- Profiling.cpp 8 Mar 2007 17:42:00 -0000 1.7 *************** *** 34,37 **** --- 34,44 ---- #include <assert.h> + #include <iostream> + + void show_profile_function(ProfileFunction* pf) { + std::cerr << "ProfileFunction(name=" << pf->Spec()->name << ", file=" << pf->Spec()->file << ", line=" << pf->Spec()->line << "): " + << "_head=" << ProfileFunction::Head() << std::endl; + } + ProfileFunction* ProfileFunction::_head = NULL; unsigned long ProfileFunction::_cnt = 0; *************** *** 61,64 **** --- 68,76 ---- spec.file = file; spec.line = line; + // show_profile_function(this); + // if (_head) { + // std::cerr << "\thead: "; + // show_profile_function(_head); + // } _next = _head; _prev = NULL; |
From: Gonzalo A. <ga...@us...> - 2007-03-08 17:41:14
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6763/include Modified Files: Profiling.h Log Message: Documented profile_stubs. Index: Profiling.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Profiling.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Profiling.h 12 Oct 2006 21:10:36 -0000 1.10 --- Profiling.h 8 Mar 2007 17:41:10 -0000 1.11 *************** *** 143,146 **** --- 143,153 ---- */ EXTERNC void profile_tick(void** cbdata, struct runspec* spec); + + /** + * Number of profile entries. + * + * @return the number of profile entries. + * + */ EXTERNC unsigned long profile_stubs(); |
From: Gonzalo A. <ga...@us...> - 2006-12-15 17:45:00
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv811/src Modified Files: Request.cpp Log Message: * Fix a possible infinite loop. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Request.cpp 6 Dec 2006 15:30:02 -0000 1.25 --- Request.cpp 15 Dec 2006 17:44:56 -0000 1.26 *************** *** 279,287 **** ProfileMe(); char *aux = buf, *eol, *eop, *eo_name; ! bool is_file, again = false; DEBUG_UPLOAD("ProcessUploadChunk: nbytes=%u boundary_length=%u", nbytes, boundary_length); if (nbytes < boundary_length) return; ! do switch (state) { case 0: // must skip until boundary DEBUG_UPLOAD("ProcessUploadChunk: state: 0"); --- 279,289 ---- ProfileMe(); char *aux = buf, *eol, *eop, *eo_name; ! bool is_file, again; DEBUG_UPLOAD("ProcessUploadChunk: nbytes=%u boundary_length=%u", nbytes, boundary_length); if (nbytes < boundary_length) return; ! do { ! again = false; ! switch (state) { case 0: // must skip until boundary DEBUG_UPLOAD("ProcessUploadChunk: state: 0"); *************** *** 390,393 **** --- 392,396 ---- nbytes = 0; break; + } } while (again); nbytes -= aux-buf; |
From: Gonzalo A. <ga...@us...> - 2006-12-06 15:32:56
|
Update of /cvsroot/mod-c/ehtml In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18124 Modified Files: TODO Log Message: * Add an error ostream. Index: TODO =================================================================== RCS file: /cvsroot/mod-c/ehtml/TODO,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TODO 12 Sep 2006 14:34:37 -0000 1.3 --- TODO 6 Dec 2006 15:32:48 -0000 1.4 *************** *** 1,2 **** --- 1,3 ---- + - Add an error ostream. - The 'style' attribute needs special attention: a) Change Component.h |
From: Gonzalo A. <ga...@us...> - 2006-12-06 15:31:44
|
Update of /cvsroot/mod-c/ehtml/samples In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17613/samples Modified Files: 03upload.cpp Log Message: Indentation changes. Index: 03upload.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/samples/03upload.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** 03upload.cpp 6 Dec 2006 15:30:03 -0000 1.1 --- 03upload.cpp 6 Dec 2006 15:31:36 -0000 1.2 *************** *** 53,57 **** out << "dev.ino=" << hex << setw(8) << setfill('0') << st.st_dev << '.' ! << hex << setw(8) << setfill('0') << st.st_ino << "<br/>" << endl; out << "mode=" << oct << setw(6) << setfill('0') << st.st_mode << dec << " owner=" << st.st_uid << ":" << st.st_gid --- 53,58 ---- out << "dev.ino=" << hex << setw(8) << setfill('0') << st.st_dev << '.' ! << hex << setw(8) << setfill('0') << st.st_ino ! << "<br/>" << endl; out << "mode=" << oct << setw(6) << setfill('0') << st.st_mode << dec << " owner=" << st.st_uid << ":" << st.st_gid |
From: Gonzalo A. <ga...@us...> - 2006-12-06 15:30:14
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16020/src Modified Files: EHTMLApplication.cpp Request.cpp Log Message: Added file upload support. Uploaded files are saved in a temporary file, which is unlinked as soon as created. Application must copy the file contents to final destination, possibly with sendfile(2). Upload progress capability is supported. A virtual method (UploadProgressCallback) is called on each chunk. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Request.cpp 1 Dec 2006 14:49:20 -0000 1.24 --- Request.cpp 6 Dec 2006 15:30:02 -0000 1.25 *************** *** 43,47 **** Request::Request( EHTMLApplication * App ) ! : RequestContext( App->GetRequestContext() ), Application( App ), HeaderParsed( false ), ContentLength( -1 ) { } --- 43,48 ---- Request::Request( EHTMLApplication * App ) ! : RequestContext( App->GetRequestContext() ), Application( App ), HeaderParsed( false ), ContentLength( -1 ), ! ReadSoFar(0), ContentType(CT_NONE), boundary(NULL), boundary_length(0) { } *************** *** 53,56 **** --- 54,59 ---- HeaderCookies.pop_front(); } + if (boundary) + free(boundary); } *************** *** 80,95 **** // Parse through the header PARSE_HEADER; ! char * content = 0; bool error = false; ! // Do we have the content length ! if ( ContentLength > 0 ) ! { ! ap_setup_client_block( r, REQUEST_CHUNKED_ERROR ); ! if ( ap_should_client_block( r ) ) { ! content = new char[ContentLength + 1]; ! error = ap_get_client_block( r, content, ContentLength) == 0; ! content[ContentLength] = 0; } } --- 83,119 ---- // Parse through the header PARSE_HEADER; ! char * content = NULL; bool error = false; ! if (ContentType == CT_MULTIPART_FORM_DATA) { ! Debug("file upload detected"); ! int length = 4095; ! ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK); ! content = new char[length+1]; ! if (!ap_should_client_block(r)) ! break; ! long nbytes; ! size_t used = 0; ! char state = 0; // 'f': fail, 'd': done, 'p': part, 'h' header ! char* varname = NULL; ! while (0 != (nbytes = ap_get_client_block(r,content+used,length-used))) { ! content[length] = '\0'; ! used += nbytes; ! ReadSoFar += nbytes; ! Application->UploadProgressCallback(); ! ProcessUploadChunk(content, used, state, varname); ! } ! delete[] content; ! content = NULL; ! } else { ! // a simple post ! long length = ContentLength > 0 ? ContentLength : 4095; ! ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK); ! if (ap_should_client_block( r )) { ! // if the client is about to send content ! content = new char[length + 1]; ! error = ap_get_client_block( r, content, length) == 0; ! content[length] = '\0'; } } *************** *** 129,132 **** --- 153,167 ---- } + int Request::GetFile( const string& name) const + { + ProfileMe(); + map<string,int>::const_iterator i = Files.find(name); + + if (i == Files.end()) + return -1; + return + i->second; + } + void Request::Error(const char* fmt, ...) const { ProfileMe(); *************** *** 197,200 **** --- 232,398 ---- } + static char* skip_eol(char* c) { + if (*c == '\r') ++c; + if (*c == '\n') ++c; + return c; + } + + static apr_status_t _close(void* p) { + int fd = (int)p; + close(fd); + return OK; + } + + /** + * Look for needle in haystack (similar to strstr(3)). + * @param haystack may be a binary data, but must be NUL terminated. + * @param hay_len length of haystack + * @param needle a NUL terminated string (must not contain NUL characters). + * @return the first location of needle inside haystack. + */ + static char* memstr(char* haystack, int hay_len, char* needle) { + while (hay_len > 0) { + char* dev = strstr(haystack, needle); + if (dev) + return dev; + size_t len = strlen(haystack); + if (len == (size_t)hay_len) + break; + hay_len -= len+1; + haystack += len+1; + } + return NULL; + } + + /** + * Process an input buffer, as far as possible. + * + * Still need to interpret Content-Transfer-Encoding part header (see rfc 2045). + * We assume that Content-Disposition is sent, which is actually not mandatory, but recommended. + * @see http://www.ietf.org/rfc/rfc1867.txt + * @see http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 + */ + //#ifdef UPLOAD_DEBUG + #define DEBUG_UPLOAD(fmt,...) Debug(fmt, ## __VA_ARGS__) + //#endif + void Request::ProcessUploadChunk(char* buf, size_t& nbytes, char& state, char*& varname) { + ProfileMe(); + char *aux = buf, *eol, *eop, *eo_name; + bool is_file, again = false; + DEBUG_UPLOAD("ProcessUploadChunk: nbytes=%u boundary_length=%u", nbytes, boundary_length); + if (nbytes < boundary_length) + return; + do switch (state) { + case 0: // must skip until boundary + DEBUG_UPLOAD("ProcessUploadChunk: state: 0"); + aux = memstr(aux, (buf+nbytes)-aux, boundary); + if (!aux) { + state = 'f'; nbytes = 0; return; + } + aux += boundary_length; + DEBUG_UPLOAD("ProcessUploadChunk: aux=%s", aux); + if (!strncmp(aux,"--",2)) { + DEBUG_UPLOAD("state 0 => d"); + state = 'd'; nbytes = 0; return; + } + aux = skip_eol(aux); + state = 'h'; + DEBUG_UPLOAD("ProcessUploadChunk: state 0 => h"); + case 'h': + // we expect something like this: + // Content-Disposition: form-data; name="submit-name" + // or + // Content-Disposition: form-data; name="files"; filename="file1.txt" + // In any case, we wait for the whole line to be in a single buffer + DEBUG_UPLOAD("ProcessUploadChunk: state: h"); + DEBUG_UPLOAD("ProcessUploadChunk: aux=%s", aux); + eol = strstr(aux, "\r\n\r\n"); + if (!eol) { + DEBUG_UPLOAD("ProcessUploadChunk: waiting for full header line"); + again = false; + break; + } + *eol = '\0'; eol += 4; + DEBUG_UPLOAD("ProcessUploadChunk: aux=%s", aux); + varname = strstr(aux, " name=\""); + if (!varname) { // anonymous variable .... fail + DEBUG_UPLOAD("ProcessUploadChunk: Anonymous variable: state h => f"); + state = 'f'; nbytes = 0; return; + } + varname += 7; + eo_name = strchr(varname,'"'); + if (!eo_name) { + DEBUG_UPLOAD("ProcessUploadChunk: Error parsing variable name: state h => f"); + state = 'f'; nbytes = 0; return; + } + is_file = strstr(aux, " filename=\""); + if (strstr(aux, "Content-Transfer-Encoding: ") != NULL) { + Error("Content-Transfer-Encoding not implemented"); + state = 'f'; nbytes = 0; return; + } + *eo_name = 0; + varname = strdup(varname); + DEBUG_UPLOAD("ProcessUploadChunk: name=\"%s\"", varname); + aux = eol; + if (!is_file) { // not a file, so store as a variable + state = 'v'; + } else { + state = 'F'; + } + case 'v': + case 'F': + DEBUG_UPLOAD("ProcessUploadChunk: state = %c: aux=\"%s\"", state, aux); + if (size_t((buf+nbytes)-aux) < boundary_length) + break; + eop = memstr(aux, (buf+nbytes)-aux, boundary); + DEBUG_UPLOAD("ProcessUploadChunk: state = %c: eop=\"%s\"", state, eop); + if (!eop) + eop = buf+nbytes-boundary_length; + else { + again = true; + if (eop[-1] == '\n') --eop; + if (eop[-1] == '\r') --eop; + DEBUG_UPLOAD("ProcessUploadChunk: state = %c: eop-1=\"%s\"", state, eop-1); + } + DEBUG_UPLOAD("ProcessUploadChunk: state = %c: eop=\"%s\"", state, eop); + if (state == 'v') { // variable + DEBUG_UPLOAD("ProcessUploadChunk: \"%s\" += string(\"%s\",%d)", varname, aux, eop-aux); + Arguments[varname] += string(aux,eop-aux); + DEBUG_UPLOAD("ProcessUploadChunk: state = v: got variable \"%s\" => \"%s\"", varname, Arguments[varname].c_str()); + } else { // file + int fd = GetFile(varname); + if (fd < 0) { + char name[] = "/tmp/ehtml_upload.XXXXXX"; + fd = mkstemp(name); + if (fd < 0) { + } else { + unlink(name); + Files.insert(pair<string,int>(varname,fd)); + apr_pool_cleanup_register(RequestContext->r->pool, (void*)fd, _close, NULL); + } + } + DEBUG_UPLOAD("ProcessUploadChunk: state = F: got file (%s => %d)", varname, fd); + write(fd, aux, eop-aux); + } + if (again) { + // if (*eop == '\r') ++eop; + // if (*eop == '\n') ++eop; + state = 0; + free(varname); + varname = NULL; + } + aux = eop; + break; + case 'p': + break; + case 'd': + case 'f': + nbytes = 0; + break; + } while (again); + nbytes -= aux-buf; + memmove(buf, aux, nbytes); + } + void Request::ParseHeader() { *************** *** 253,256 **** --- 451,483 ---- } } + // Content Type? + Debug("Parsing %s: %s", tmp->key, tmp->val); + if (ContentType == CT_NONE && strncasecmp("tent-Type", _tmp+1, 9 ) == 0) { + // Seems so, check for special values + Debug("Parsing CONTENT_TYPE: %s", tmp->val); + if (strncmp(tmp->val, "multipart/form-data", 19) == 0) { + ContentType = CT_MULTIPART_FORM_DATA; + boundary = strchr(tmp->val + 19, ';'); + if (boundary) + boundary = strstr(skip_ws(boundary), "boundary="); + if (boundary) { + boundary += 9; + char* end = boundary; + while (!isspace(*end) && *end) ++end; + boundary_length = end-boundary; + char* tmpb = (char*)malloc(boundary_length+2+1); + tmpb[0] = '-'; + tmpb[1] = '-'; + strncpy(tmpb+2, boundary, boundary_length); + boundary_length += 2; + tmpb[boundary_length] = '\0'; + boundary = tmpb; + Debug("boundary=%s", boundary); + Debug("boundary_length=%d", boundary_length); + } + } else if (strncmp(tmp->val, "application/x-www-form-urlencoded", 33) == 0) { + ContentType = CT_APPLICATION_URLENCODED; + } + } } } Index: EHTMLApplication.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/EHTMLApplication.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** EHTMLApplication.cpp 6 Nov 2006 17:09:54 -0000 1.20 --- EHTMLApplication.cpp 6 Dec 2006 15:30:01 -0000 1.21 *************** *** 258,261 **** --- 258,266 ---- } + void EHTMLApplication::UploadProgressCallback() { + ProfileMe(); + // currently, it does nothing. + } + static const char* prefix(int level) { switch (level) { |
From: Gonzalo A. <ga...@us...> - 2006-12-06 15:30:08
|
Update of /cvsroot/mod-c/ehtml/samples In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16020/samples Modified Files: Makefile.am Added Files: 03upload.cpp Log Message: Added file upload support. Uploaded files are saved in a temporary file, which is unlinked as soon as created. Application must copy the file contents to final destination, possibly with sendfile(2). Upload progress capability is supported. A virtual method (UploadProgressCallback) is called on each chunk. Index: Makefile.am =================================================================== RCS file: /cvsroot/mod-c/ehtml/samples/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.am 17 Sep 2006 18:14:51 -0000 1.6 --- Makefile.am 6 Dec 2006 15:30:03 -0000 1.7 *************** *** 12,16 **** # -shared -o basic.so -lehtml samplesdir=$(libdir)/ehtml/samples ! samples_LTLIBRARIES = libsamplebasic.la libsamplesession.la libsamplebasic_la_SOURCES = 01basic.cpp libsamplebasic_la_LDFLAGS = -shared -module --- 12,16 ---- # -shared -o basic.so -lehtml samplesdir=$(libdir)/ehtml/samples ! samples_LTLIBRARIES = libsamplebasic.la libsamplesession.la libsampleupload.la libsamplebasic_la_SOURCES = 01basic.cpp libsamplebasic_la_LDFLAGS = -shared -module *************** *** 20,21 **** --- 20,24 ---- libsamplesession_la_LDFLAGS = -shared -module + libsampleupload_la_SOURCES = 03upload.cpp + libsampleupload_la_LDFLAGS = -shared -module + --- NEW FILE: 03upload.cpp --- // $Id: 03upload.cpp,v 1.1 2006/12/06 15:30:03 garana Exp $ #include <ehtml.h> #include <EHTMLApplication.h> #include <Page.h> #include <Label.h> #include <http_log.h> #include <time.h> #include <iomanip> using namespace std; static const char* fldName = "file0"; class FileUploadEHTMLApp: public EHTMLApplication { int fd; public: FileUploadEHTMLApp(request_context* req): EHTMLApplication(req), fd(-1) { req->r->content_type = "text/html"; } virtual int DoReadStage() { int dev = EHTMLApplication::DoReadStage(); // file contents are is read return dev; } virtual int DoInitStage() { int dev = EHTMLApplication::DoInitStage(); fd = GetRequest()->GetFile(fldName); Debug("%s => %d", fldName, fd); return dev; } virtual int DoRenderStage() { ostream& out = GetResponse()->GetStream(); if (fd >= 0) { struct stat st; if (fstat(fd, &st) < 0) { out << "Error statting fd=" << fd << ": " << strerror(errno) << endl; return 0; } out << "dev.ino=" << hex << setw(8) << setfill('0') << st.st_dev << '.' << hex << setw(8) << setfill('0') << st.st_ino << "<br/>" << endl; out << "mode=" << oct << setw(6) << setfill('0') << st.st_mode << dec << " owner=" << st.st_uid << ":" << st.st_gid << "<br/>" << endl; out << "nlink=" << st.st_nlink << "<br/>" << endl; out << "size=" << st.st_size << "<br/>" << endl; return 0; } out << "<form action=\"?\" method=\"POST\" enctype=\"multipart/form-data\">" << endl << "file: <input type=\"file\" name=\"file0\"><br/>" << endl << "<input type=\"submit\" name=\"send file\"><br/>" << endl; return 0; } }; extern "C" int ehtml_run(request_context* rc) { FileUploadEHTMLApp ap(rc); return ap.Run(); } |
From: Gonzalo A. <ga...@us...> - 2006-12-06 15:30:07
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16020/include Modified Files: EHTMLApplication.h Request.h Log Message: Added file upload support. Uploaded files are saved in a temporary file, which is unlinked as soon as created. Application must copy the file contents to final destination, possibly with sendfile(2). Upload progress capability is supported. A virtual method (UploadProgressCallback) is called on each chunk. Index: EHTMLApplication.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/EHTMLApplication.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EHTMLApplication.h 6 Nov 2006 17:09:54 -0000 1.12 --- EHTMLApplication.h 6 Dec 2006 15:30:02 -0000 1.13 *************** *** 251,254 **** --- 251,261 ---- Session* GetSession() { return session; } + /** + * Called when the request is a file upload. + * Should be overloaded by your application, but your application should call + * EHTMLApplication::UploadProgressCallback() any way. + * The progress information is located in GetRequest()->{ReadSoFar,ContentLength}. + */ + virtual void UploadProgressCallback(); protected: friend class Session; Index: Request.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Request.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Request.h 1 Dec 2006 14:45:47 -0000 1.11 --- Request.h 6 Dec 2006 15:30:03 -0000 1.12 *************** *** 104,107 **** --- 104,122 ---- /** + * Returns the file descriptor associated with the file uploaded + * + * @param name + * The name of the form input type=file. + */ + int GetFile( const std::string& name ) const; + + /* + * Return the list of uploaded files. + * + * @return the list of uploaded files. + */ + const std::map<std::string,int>& GetFiles() { return Files; } + + /** * Error logging method. */ *************** *** 144,148 **** --- 159,173 ---- mutable std::list<std::string> cookies_returned; + /** + * Uploaded files. + * + * As a file is uploaded, it is saved under a temporary file (which is created with mkstemp). + */ + std::map<std::string,int> Files; + + void ProcessCookieHeader(const char* value); + + void ProcessUploadChunk(char* buf, size_t& nbytes, char& state, char*& varname); public: /** *************** *** 188,191 **** --- 213,247 ---- */ long ContentLength; + /** + * How many bytes have been read so far. + * Begins with 0. Remain 0 if the reques has no body + */ + long ReadSoFar; + /** + * Recognized content type enumeration. + */ + typedef enum ctype { + CT_NONE, + CT_MULTIPART_FORM_DATA, + CT_APPLICATION_URLENCODED + } ctype_t; + /** + * The content type of the request. + * Currently, it only supports these two values: + * <li> multipart/form-data (for file uploads) + * <li> application/x-www-form-urlencoded (for normal posts) + */ + ctype_t ContentType; + + /** + * If this request is a file upload, the boundary is set. + */ + char* boundary; + + /** + * length of the boundary string (strlen(boundary)). + */ + size_t boundary_length; + /** * A list of special headers. |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:49:23
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv6300/src Modified Files: Request.cpp Log Message: * apr_table_entry_t value member is 'val', not 'value'. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Request.cpp 1 Dec 2006 14:47:29 -0000 1.23 --- Request.cpp 1 Dec 2006 14:49:20 -0000 1.24 *************** *** 245,252 **** if (*end != '\0') { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Invalid content length header value \"%s\"", tmp->value); } else if (clen > LONG_MAX) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Content length header value \"%s\" too long", tmp->value); } else { ContentLength = clen; --- 245,252 ---- if (*end != '\0') { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Invalid content length header value \"%s\"", tmp->val); } else if (clen > LONG_MAX) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Content length header value \"%s\" too long", tmp->val); } else { ContentLength = clen; |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:47:36
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5790/src Modified Files: Request.cpp Log Message: * apr_table_entry_t value member is 'val', not 'value'. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Request.cpp 1 Dec 2006 14:45:47 -0000 1.22 --- Request.cpp 1 Dec 2006 14:47:29 -0000 1.23 *************** *** 242,246 **** // We have the content length char* end; ! unsigned long clen = strtoul(tmp->value, &end, 10); if (*end != '\0') { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, --- 242,246 ---- // We have the content length char* end; ! unsigned long clen = strtoul(tmp->val, &end, 10); if (*end != '\0') { ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, |
From: Matej U. <mat...@gm...> - 2006-12-01 14:46:56
|
On Fri, 2006-12-01 at 14:43 +0000, Gonzalo Arana wrote: > Update of /cvsroot/mod-c/ehtml/src > In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4099/src > > Modified Files: > Request.cpp > Log Message: > * Previous commit (about double delete[]) was due to a temporary brain damage. I hope you're ok now :-D Best luck! --- Matej |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:45:50
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4952/src Modified Files: Request.cpp Log Message: * ContentLength is now a long value, rather than a pair of C strings. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Request.cpp 1 Dec 2006 14:43:34 -0000 1.21 --- Request.cpp 1 Dec 2006 14:45:47 -0000 1.22 *************** *** 33,36 **** --- 33,38 ---- #include "Profiling.h" + #include <http_log.h> + using namespace std; *************** *** 41,45 **** Request::Request( EHTMLApplication * App ) ! : RequestContext( App->GetRequestContext() ), Application( App ), HeaderParsed( false ), ContentLength( 0 ) { } --- 43,47 ---- Request::Request( EHTMLApplication * App ) ! : RequestContext( App->GetRequestContext() ), Application( App ), HeaderParsed( false ), ContentLength( -1 ) { } *************** *** 82,97 **** // Do we have the content length ! if ( ContentLength ) { ap_setup_client_block( r, REQUEST_CHUNKED_ERROR ); if ( ap_should_client_block( r ) ) { ! int len = atoi( ContentLength->Value ); ! if ( len > 0 ) ! { ! content = new char[len + 1]; ! error = ap_get_client_block( r, content, len ) == 0; ! content[len] = 0; ! } } } --- 84,95 ---- // Do we have the content length ! if ( ContentLength > 0 ) { ap_setup_client_block( r, REQUEST_CHUNKED_ERROR ); if ( ap_should_client_block( r ) ) { ! content = new char[ContentLength + 1]; ! error = ap_get_client_block( r, content, ContentLength) == 0; ! content[ContentLength] = 0; } } *************** *** 241,247 **** // Content length? ! if ( !ContentLength && strncasecmp( "tent-Length", _tmp + 1, 11 ) == 0 ) // We have the content length ! ContentLength = ( HeaderEntry* ) tmp; } } --- 239,256 ---- // Content length? ! if ( ContentLength == - 1 && strncasecmp( "tent-Length", _tmp + 1, 11 ) == 0 ) { // We have the content length ! char* end; ! unsigned long clen = strtoul(tmp->value, &end, 10); ! if (*end != '\0') { ! ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Invalid content length header value \"%s\"", tmp->value); ! } else if (clen > LONG_MAX) { ! ap_log_error(APLOG_MARK, APLOG_ERR, 0, RequestContext->r->server, ! "Content length header value \"%s\" too long", tmp->value); ! } else { ! ContentLength = clen; ! } ! } } } |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:45:50
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4952/include Modified Files: Request.h Log Message: * ContentLength is now a long value, rather than a pair of C strings. Index: Request.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Request.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Request.h 24 Oct 2006 15:27:03 -0000 1.10 --- Request.h 1 Dec 2006 14:45:47 -0000 1.11 *************** *** 184,190 **** }; /** ! * The content length header key/value pair. */ ! HeaderEntry * ContentLength; /** * A list of special headers. --- 184,191 ---- }; /** ! * The content length header value. ! * Will be set to -1 if unset. */ ! long ContentLength; /** * A list of special headers. |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:43:41
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4099/src Modified Files: Request.cpp Log Message: * Previous commit (about double delete[]) was due to a temporary brain damage. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Request.cpp 1 Dec 2006 14:17:40 -0000 1.20 --- Request.cpp 1 Dec 2006 14:43:34 -0000 1.21 *************** *** 51,56 **** HeaderCookies.pop_front(); } - if (content) - delete[] content; } --- 51,54 ---- |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:17:43
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26933 Modified Files: Request.cpp Log Message: * Avoid a double delete caused by previous commit. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Request.cpp 1 Dec 2006 14:14:52 -0000 1.19 --- Request.cpp 1 Dec 2006 14:17:40 -0000 1.20 *************** *** 104,107 **** --- 104,108 ---- if ( content ) delete[] content; + content = NULL; return 1; } |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:14:55
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25428 Modified Files: Request.cpp Log Message: * Fix a memleak. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Request.cpp 1 Dec 2006 14:13:53 -0000 1.18 --- Request.cpp 1 Dec 2006 14:14:52 -0000 1.19 *************** *** 51,54 **** --- 51,56 ---- HeaderCookies.pop_front(); } + if (content) + delete[] content; } |
From: Gonzalo A. <ga...@us...> - 2006-12-01 14:13:57
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24961 Modified Files: Request.cpp Log Message: * Use the propper delete[] operator (rather than delete). Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Request.cpp 1 Dec 2006 13:42:52 -0000 1.17 --- Request.cpp 1 Dec 2006 14:13:53 -0000 1.18 *************** *** 101,105 **** { if ( content ) ! delete content; return 1; } --- 101,105 ---- { if ( content ) ! delete[] content; return 1; } |
From: Gonzalo A. <ga...@us...> - 2006-12-01 13:43:01
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11020 Modified Files: Request.cpp Log Message: * Silly indent fix. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Request.cpp 1 Dec 2006 13:31:44 -0000 1.16 --- Request.cpp 1 Dec 2006 13:42:52 -0000 1.17 *************** *** 233,237 **** if ( strncasecmp( "kie", _tmp + 1, 3 ) == 0 ) // We have possibly, more than one cookie ! ProcessCookieHeader(tmp->val); } // Is it Content-Length --- 233,237 ---- if ( strncasecmp( "kie", _tmp + 1, 3 ) == 0 ) // We have possibly, more than one cookie ! ProcessCookieHeader(tmp->val); } // Is it Content-Length |
From: Gonzalo A. <ga...@us...> - 2006-12-01 13:31:55
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3953 Modified Files: Request.cpp Log Message: * Header names are case insensitive (rfc2616, sect 4.2). Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Request.cpp 6 Nov 2006 17:09:54 -0000 1.15 --- Request.cpp 1 Dec 2006 13:31:44 -0000 1.16 *************** *** 231,235 **** // Cookie? ! if ( strncmp( "kie", _tmp + 1, 3 ) == 0 ) // We have possibly, more than one cookie ProcessCookieHeader(tmp->val); --- 231,235 ---- // Cookie? ! if ( strncasecmp( "kie", _tmp + 1, 3 ) == 0 ) // We have possibly, more than one cookie ProcessCookieHeader(tmp->val); *************** *** 240,244 **** // Content length? ! if ( !ContentLength && strncmp( "tent-Length", _tmp + 1, 11 ) == 0 ) // We have the content length ContentLength = ( HeaderEntry* ) tmp; --- 240,244 ---- // Content length? ! if ( !ContentLength && strncasecmp( "tent-Length", _tmp + 1, 11 ) == 0 ) // We have the content length ContentLength = ( HeaderEntry* ) tmp; |
From: Gonzalo A. <ga...@us...> - 2006-11-13 18:52:00
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26334/include Modified Files: Common.h Log Message: * (url|base64|hex)(en|de)code are written. Removed "TODO writeme" comments. Index: Common.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Common.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Common.h 24 Oct 2006 15:27:03 -0000 1.12 --- Common.h 9 Nov 2006 13:44:07 -0000 1.13 *************** *** 202,216 **** const char* ehtml_strerror(int errno); ! std::string urlencode(const MemBuf& mb); //TODO: updateme ! std::string urlencode(const std::string& s); //TODO: updateme ! MemBuf urldecode(const std::string& s) throw (const char*); //TODO: updateme ! std::string hexencode(const MemBuf& mb); //TODO: writeme ! std::string hexencode(const std::string& s); //TODO: updateme ! MemBuf hexdecode(const std::string& s) throw (const char*); //TODO: writeme ! std::string base64encode(const MemBuf& mb); //TODO: writeme ! std::string base64encode(const std::string& s); //TODO: updateme ! MemBuf base64decode(const std::string& s) throw (const char*); //TODO: writeme unsigned long xatoul(const char* s) throw(const char*); --- 202,216 ---- const char* ehtml_strerror(int errno); ! std::string urlencode(const MemBuf& mb); ! std::string urlencode(const std::string& s); ! MemBuf urldecode(const std::string& s) throw (const char*); ! std::string hexencode(const MemBuf& mb); ! std::string hexencode(const std::string& s); ! MemBuf hexdecode(const std::string& s) throw (const char*); ! std::string base64encode(const MemBuf& mb); ! std::string base64encode(const std::string& s); ! MemBuf base64decode(const std::string& s) throw (const char*); unsigned long xatoul(const char* s) throw(const char*); |
From: Gonzalo A. <ga...@us...> - 2006-11-13 18:39:51
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv18276/src Modified Files: Common.cpp Log Message: * Fixed a typo related with base64 encoding internal data structure. Index: Common.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Common.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Common.cpp 24 Oct 2006 15:27:03 -0000 1.16 --- Common.cpp 9 Nov 2006 15:57:25 -0000 1.17 *************** *** 394,398 **** "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" ! "0123456879" "+/"; --- 394,398 ---- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" ! "0123456789" "+/"; |
From: Gonzalo A. <ga...@us...> - 2006-11-06 19:50:01
|
Update of /cvsroot/mod-c/ehtml/include In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23720/include Modified Files: ehtml.h Session.h Log Message: * Session fixes: the 'Location' based session configuration works now. Basically, we added 'checkargs' on ehtml session side. Index: ehtml.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/ehtml.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ehtml.h 12 Oct 2006 21:10:36 -0000 1.21 --- ehtml.h 6 Nov 2006 19:49:43 -0000 1.22 *************** *** 90,96 **** char key_size; /** ! * Contains pointers to functions for session management. */ ! ses_api_t* session_funcs; } mod_c_dir_config; --- 90,108 ---- char key_size; /** ! * The session driver managment */ ! const char* session_driver; ! /** ! * The session driver arguments ! */ ! const char* session_driver_arguments; ! /** ! * The session ID driver managment ! */ ! const char* session_id_driver; ! /** ! * The session ID driver arguments ! */ ! const char* session_id_driver_arguments; } mod_c_dir_config; Index: Session.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/include/Session.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Session.h 12 Oct 2006 21:10:36 -0000 1.15 --- Session.h 6 Nov 2006 19:49:43 -0000 1.16 *************** *** 92,95 **** --- 92,96 ---- */ virtual bool SetArgs(const std::string& arg) = 0; + virtual bool CheckArgs(const std::string& arg) = 0; virtual bool ValidID(SessionID& id) = 0; virtual SessionID GenerateID() = 0; *************** *** 118,121 **** --- 119,127 ---- /** + * Check for argument Syntax. + */ + virtual bool CheckArgs(const std::string& arg) = 0; + + /** * Sets the application to use. May be called more than once. * @return false on error, true otherwise. *************** *** 185,188 **** --- 191,195 ---- */ EXTERNC int registerSessionDriver(const char* driver_name, const char* filename); + /** * Selects a session driver (and sets the argument). *************** *** 194,197 **** --- 201,210 ---- /** + * Checks a session driver (and its argument). + * @return 0 on success, a negative value on error. + */ + EXTERNC int checkSessionDriver(const char* name, const char* arg); + + /** * Registers a session id generation driver. * Registers the session driver "<param>driver_name</param>" located in *************** *** 201,204 **** --- 214,224 ---- */ EXTERNC int registerSessionIDDriver(const char* driver_name, const char* filename); + + /** + * Checks a session id generation driver (and its argument). + * @return 0 on success, a negative value on error. + */ + EXTERNC int checkSessionIDDriver(const char* name, const char* arg); + /** * Selects a session id generation driver (and sets the argument). |
From: Gonzalo A. <ga...@us...> - 2006-11-06 19:49:55
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23720/src Modified Files: DefaultSessionDriver.h DefaultSessionDriver.cpp DefaultSessionIDDriver.cpp DiskSessionDriver.cpp Session.cpp Log Message: * Session fixes: the 'Location' based session configuration works now. Basically, we added 'checkargs' on ehtml session side. Index: DefaultSessionDriver.h =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/DefaultSessionDriver.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DefaultSessionDriver.h 12 Oct 2006 21:10:36 -0000 1.2 --- DefaultSessionDriver.h 6 Nov 2006 19:49:43 -0000 1.3 *************** *** 48,51 **** --- 48,52 ---- ~DefaultSessionDriver(); virtual bool SetArgs(const std::string& arg); + virtual bool CheckArgs(const std::string& arg); virtual bool Connect(); virtual bool Disconnect(); Index: DefaultSessionDriver.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/DefaultSessionDriver.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DefaultSessionDriver.cpp 12 Oct 2006 21:10:36 -0000 1.4 --- DefaultSessionDriver.cpp 6 Nov 2006 19:49:43 -0000 1.5 *************** *** 86,89 **** --- 86,124 ---- } + bool DefaultSessionDriver::CheckArgs(const string& arg) { + ProfileMe(); + istringstream s(arg); + string opt; + while (s >> opt) { + if (!strncmp("addr=",opt.c_str(),5)) { + string _addr(opt.c_str()+5); + if (!strncmp("unix://",_addr.c_str(),7)) { + ; + } else if (!_addr[0] == '/') { + ; + } else if (!strncmp("inet://",_addr.c_str(),7)) { + char host[16]; + unsigned short port; + if (sscanf(_addr.c_str()+7, "%[.0-9]:%hu", host, &port) != 2) { + errno = EINVAL; + return false; + } + struct sockaddr_in _addr; + if (!inet_aton(host, &_addr.sin_addr)) { + errno = EINVAL; + return false; + } + } else { + errno = EINVAL; + return false; + } + } else { + errno = EINVAL; + return false; + } + } + return true; + } + void DefaultSessionDriver::init() { Index: DefaultSessionIDDriver.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/DefaultSessionIDDriver.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultSessionIDDriver.cpp 12 Oct 2006 21:10:36 -0000 1.3 --- DefaultSessionIDDriver.cpp 6 Nov 2006 19:49:43 -0000 1.4 *************** *** 90,93 **** --- 90,94 ---- DefaultSessionIDDriver(): extra_entropy(0) { ; } virtual bool SetArgs(const string& id); + virtual bool CheckArgs(const string& id); virtual bool ValidID(SessionID& id); virtual SessionID GenerateID(); *************** *** 97,100 **** --- 98,103 ---- ProfileMe(); bool dev = true; + if (!arg[0]) + return true; if (!strncmp(arg.c_str(), "extra_entropy=", 14)) extra_entropy = xatoul(arg.c_str()+14); *************** *** 106,109 **** --- 109,126 ---- } + bool DefaultSessionIDDriver::CheckArgs(const string& arg) { + ProfileMe(); + bool dev = true; + if (!arg[0]) + return true; + if (!strncmp(arg.c_str(), "extra_entropy=", 14)) + ; + else { + errno = EINVAL; + dev = false; + } + return dev; + } + bool DefaultSessionIDDriver::ValidID(SessionID& id) { ProfileMe(); Index: Session.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Session.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Session.cpp 12 Oct 2006 21:10:36 -0000 1.19 --- Session.cpp 6 Nov 2006 19:49:43 -0000 1.20 *************** *** 219,222 **** --- 219,231 ---- } + int checkSessionDriver(const char* name, const char* arg) { + SessionDriver* selected = SessionDriver::getByName(name); + if (selected == NULL) { + errno = ENOENT; + return -1; + } + return selected->CheckArgs(arg) ? 0 : -1; + } + int useSessionDriver(const char* name, const char* arg) { SessionDriver* selected = SessionDriver::getByName(name); *************** *** 259,262 **** --- 268,280 ---- } + int checkSessionIDDriver(const char* name, const char* arg) { + SessionIDDriver* selected = SessionIDDriver::getByName(name); + if (selected == NULL) { + errno = ENOENT; + return -1; + } + return selected->CheckArgs(arg) ? 0 : -1; + } + int useSessionIDDriver(const char* name, const char* arg) { SessionIDDriver* selected = SessionIDDriver::getByName(name); Index: DiskSessionDriver.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/DiskSessionDriver.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DiskSessionDriver.cpp 3 Nov 2006 20:34:53 -0000 1.9 --- DiskSessionDriver.cpp 6 Nov 2006 19:49:43 -0000 1.10 *************** *** 54,57 **** --- 54,58 ---- virtual ~DiskSessionDriver() { ; } virtual bool SetArgs(const std::string& arg); + virtual bool CheckArgs(const std::string& arg); virtual bool Connect(); virtual bool Disconnect(); *************** *** 125,128 **** --- 126,151 ---- } + bool DiskSessionDriver::CheckArgs(const string& arg) { + ProfileMe(); + istringstream i(arg.c_str()); + string _arg; + while (i >> _arg) { + if (!strncmp(_arg.c_str(),"spool=",6)) { + ; + } else if (!strncmp(_arg.c_str(), "collect_prob=", 13)) { + double p = xatod(_arg.c_str()+13); + if (p > 1 || p < 0) + return false; + } else if (!strncmp(_arg.c_str(), "old_enough=", 11)) { + char* end; + strtoul(_arg.c_str()+11, &end, 10); + if (*end) + return false; + } else + return false; + } + return true; + } + bool DiskSessionDriver::Connect() { ProfileMe(); |
From: Gonzalo A. <ga...@us...> - 2006-11-06 19:48:34
|
Update of /cvsroot/mod-c/mod_c/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22618/src Modified Files: mod_c.c Log Message: * Session fixes: the 'Location' based session configuration works now. Basically, we store the name & arguments of the driver in a per-dir config record. Right before calling ehtml handler, we 'select' the driver. Index: mod_c.c =================================================================== RCS file: /cvsroot/mod-c/mod_c/src/mod_c.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** mod_c.c 12 Oct 2006 21:12:07 -0000 1.32 --- mod_c.c 6 Nov 2006 19:48:20 -0000 1.33 *************** *** 38,44 **** --- 38,46 ---- //#include <mod_c_sessions.h> #include <http_log.h> + #include <apr_strings.h> #include <assert.h> + /** * The name of the EHMTL file handler. *************** *** 132,135 **** --- 134,167 ---- } + if (dir_config->sessions) { + if (dir_config->session_driver == NULL) { + RERROR(r, "A session driver must be specified if sessions are to " + "be enabled"); + return HTTP_INTERNAL_SERVER_ERROR; + } + if (dir_config->session_id_driver == NULL) { + RERROR(r, "A session ID driver must be specified if sessions are to " + "be enabled"); + return HTTP_INTERNAL_SERVER_ERROR; + } + if (useSessionDriver(dir_config->session_driver, + dir_config->session_driver_arguments) < 0) { + RERROR(r, "Error selecting session driver %s " + "or applying arguments \"%s\"", + dir_config->session_driver, + dir_config->session_driver_arguments); + return HTTP_INTERNAL_SERVER_ERROR; + } + + if (useSessionIDDriver(dir_config->session_id_driver, + dir_config->session_id_driver_arguments) < 0) { + RERROR(r, "Error selecting session ID driver %s " + "or applying arguments \"%s\"", + dir_config->session_id_driver, + dir_config->session_id_driver_arguments); + return HTTP_INTERNAL_SERVER_ERROR; + } + } + // We have found the library that contains the EHTML application // execute its ehtml_run function *************** *** 277,286 **** // Set the default duration of a session dir_config->session_duration = 10080 /* DEF_SESSION_DURATION*/; - // Set the default session management type - dir_config->session_funcs = 0; // Set the default cookieless setting dir_config->cookieless = 0; // Set the default key size setting dir_config->key_size = 64 /*DEF_ID_SIZE*/; return dir_config; --- 309,321 ---- // Set the default duration of a session dir_config->session_duration = 10080 /* DEF_SESSION_DURATION*/; // Set the default cookieless setting dir_config->cookieless = 0; // Set the default key size setting dir_config->key_size = 64 /*DEF_ID_SIZE*/; + + dir_config->session_driver = NULL; + dir_config->session_driver_arguments = NULL; + dir_config->session_id_driver = NULL; + dir_config->session_id_driver_arguments = NULL; return dir_config; *************** *** 459,466 **** { // mod_c_config * config = c_sconfig(parms->server); ! // mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (useSessionDriver(type, arguments) < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionType: unknown session type %s, " --- 494,501 ---- { // mod_c_config * config = c_sconfig(parms->server); ! mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (checkSessionDriver(type, arguments ? arguments : "") < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionType: unknown session type %s, " *************** *** 468,471 **** --- 503,508 ---- return errorMsg; } + dir_config->session_driver = apr_pstrdup(parms->pool, type); + dir_config->session_driver_arguments = arguments ? apr_pstrdup(parms->pool, arguments) : ""; return NULL; } *************** *** 477,484 **** { // mod_c_config * config = c_sconfig(parms->server); ! // mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (useSessionIDDriver(type, arguments) < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionIDType: unknown session id type %s, " --- 514,521 ---- { // mod_c_config * config = c_sconfig(parms->server); ! mod_c_dir_config* dir_config = c_pconfig(parms); // Search for the session driver that supports the desired type of session // management ! if (checkSessionIDDriver(type, arguments ? arguments : "") < 0) { char* errorMsg = (char*)apr_palloc(parms->temp_pool, 512); snprintf(errorMsg, 512, "EHTMLSessionIDType: unknown session id type %s, " *************** *** 486,489 **** --- 523,528 ---- return errorMsg; } + dir_config->session_id_driver = apr_pstrdup(parms->pool, type); + dir_config->session_id_driver_arguments = arguments ? apr_pstrdup(parms->pool, arguments) : ""; return NULL; } |
From: Gonzalo A. <ga...@us...> - 2006-11-06 17:10:06
|
Update of /cvsroot/mod-c/ehtml/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2415/src Modified Files: EHTMLApplication.cpp Request.cpp Log Message: Renamed logging methods that receive a va_list argument. g++ gets confused because a va_list is compatible with a char* (apparently). By renaming these methods, we eliminate the ambiguity between vararg methods and va_list methods. Index: Request.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/Request.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Request.cpp 18 Oct 2006 12:51:12 -0000 1.14 --- Request.cpp 6 Nov 2006 17:09:54 -0000 1.15 *************** *** 136,140 **** va_list l; va_start(l, fmt); ! Application->Error(fmt, l); va_end(l); } --- 136,140 ---- va_list l; va_start(l, fmt); ! Application->vError(fmt, l); va_end(l); } *************** *** 146,150 **** va_list l; va_start(l, fmt); ! Application->Debug(fmt, l); va_end(l); } --- 146,150 ---- va_list l; va_start(l, fmt); ! Application->vDebug(fmt, l); va_end(l); } Index: EHTMLApplication.cpp =================================================================== RCS file: /cvsroot/mod-c/ehtml/src/EHTMLApplication.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** EHTMLApplication.cpp 31 Oct 2006 19:17:56 -0000 1.19 --- EHTMLApplication.cpp 6 Nov 2006 17:09:54 -0000 1.20 *************** *** 240,244 **** } ! void EHTMLApplication::Error(const char* fmt, va_list l) const { ProfileMe(); Log(APLOG_ERR, fmt, l); --- 240,244 ---- } ! void EHTMLApplication::vError(const char* fmt, va_list l) const { ProfileMe(); Log(APLOG_ERR, fmt, l); *************** *** 253,257 **** } ! void EHTMLApplication::Debug(const char* fmt, va_list l) const { ProfileMe(); Log(APLOG_DEBUG, fmt, l); --- 253,257 ---- } ! void EHTMLApplication::vDebug(const char* fmt, va_list l) const { ProfileMe(); Log(APLOG_DEBUG, fmt, l); |