From: <mc...@pr...> - 2004-01-27 14:23:44
|
Update of /cvsroot/middle-man/middleman/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6569/src Modified Files: interface.c prefetch.c protocol.c section.c Log Message: Index: interface.c =================================================================== RCS file: /cvsroot/middle-man/middleman/src/interface.c,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** interface.c 17 Jan 2004 16:03:23 -0000 1.178 --- interface.c 24 Jan 2004 17:40:08 -0000 1.179 *************** *** 595,599 **** url = url_parse(qadd); if (url != NULL) ! prefetch_section.queue_add(url, 1); } --- 595,599 ---- url = url_parse(qadd); if (url != NULL) ! prefetch_section.queue_add(url, ~0, 1); } Index: prefetch.c =================================================================== RCS file: /cvsroot/middle-man/middleman/src/prefetch.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** prefetch.c 22 Jan 2004 03:31:55 -0000 1.26 --- prefetch.c 24 Jan 2004 17:40:49 -0000 1.27 *************** *** 46,49 **** --- 46,50 ---- prefetch_templ.push_back(Field("attribute", "Tag attribute", "")); prefetch_templ.push_back(Field("pattern", "Attribute pattern", "")); + prefetch_templ.push_back(Field("maxsize", "Maximum file size", 0, Field::FILE_SIZE)); prefetch_templ.push_back(Field("recursion", "Recursion level", 1, Field::INT)); *************** *** 82,86 **** attribute(item.field_vec[4].string_value), pattern(item.field_vec[5].string_value), ! recursion(item.field_vec[6].int_value) { pe = (pattern != "") ? reg_compile(pattern.c_str(), REGFLAGS) : NULL; --- 83,88 ---- attribute(item.field_vec[4].string_value), pattern(item.field_vec[5].string_value), ! maxsize(item.field_vec[6].uint_value), ! recursion(item.field_vec[7].int_value) { pe = (pattern != "") ? reg_compile(pattern.c_str(), REGFLAGS) : NULL; *************** *** 94,97 **** --- 96,100 ---- attribute(prefetch.attribute), pattern(prefetch.pattern), + maxsize(prefetch.maxsize), recursion(prefetch.recursion) { *************** *** 119,123 **** prefetch->unlock(); ! protocol_prefetch(queue->url, queue->depth); prefetch_queue_free(queue); --- 122,126 ---- prefetch->unlock(); ! protocol_prefetch(queue->url, queue->maxsize, queue->depth); prefetch_queue_free(queue); *************** *** 130,134 **** } ! int protocol_prefetch(URL *url, int depth) { int x; --- 133,137 ---- } ! int protocol_prefetch(URL *url, unsigned int maxsize, int depth) { int x; *************** *** 149,152 **** --- 152,156 ---- connection->ip = xstrdup("127.0.0.1"); connection->interface = xstrdup("127.0.0.1"); + connection->transferlimit = maxsize; connection->header = header_new(); *************** *** 205,209 **** } ! void PrefetchSection::queue_add(URL *url, int depth) { char *ptr; --- 209,213 ---- } ! void PrefetchSection::queue_add(URL *url, unsigned int maxsize, int depth) { char *ptr; *************** *** 236,239 **** --- 240,244 ---- queue = (PREFETCH_QUEUE*)xmalloc(sizeof(struct PREFETCH_QUEUE)); queue->url = url; + queue->maxsize = maxsize; queue->depth = depth; queue->next = NULL; *************** *** 286,289 **** --- 291,295 ---- URL *url = NULL; int ret; + unsigned int maxsize = 0; char *ptr; struct htmlstream_tag_property *property; *************** *** 333,342 **** url_free(url); url = NULL; } - - /* this entry didn't match, but others may. */ - continue; } /* don't allow more than one to match */ break; --- 339,350 ---- url_free(url); url = NULL; + + /* this entry didn't match, but others may. */ + continue; } } + maxsize = prefetch->maxsize; + /* don't allow more than one to match */ break; *************** *** 352,356 **** prefetch_section.unlock(); ! if (url != NULL) ! prefetch_section.queue_add(url, connection->depth + 1); } --- 360,366 ---- prefetch_section.unlock(); ! if (url != NULL) { ! if (maxsize == 0) maxsize = ~0; ! prefetch_section.queue_add(url, maxsize, connection->depth + 1); ! } } Index: protocol.c =================================================================== RCS file: /cvsroot/middle-man/middleman/src/protocol.c,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** protocol.c 15 Jan 2004 09:49:06 -0000 1.162 --- protocol.c 24 Jan 2004 17:40:49 -0000 1.163 *************** *** 387,391 **** --- 387,394 ---- int transfer_limit_check(CONNECTION * connection) { + putlog(MMLOG_DEBUG, "transfer limit: %u cl: %u", connection->transferlimit, connection->rheader->content_length); if ((connection->rheader->flags & HEADER_CL) && (connection->cachemap == NULL || (connection->flags & CONNECTION_LIMITCACHE)) && (connection->rheader->content_length > connection->transferlimit)) { + putlog(MMLOG_LIMITS, "transfer would exceed transfer limit"); + template_section.send("maxtransfer", connection, 503); Index: section.c =================================================================== RCS file: /cvsroot/middle-man/middleman/src/section.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** section.c 20 Jan 2004 18:31:24 -0000 1.19 --- section.c 24 Jan 2004 17:41:04 -0000 1.20 *************** *** 437,441 **** case STRING_SELECT_ONE: for (ssv = string_select_value.begin(); ssv != string_select_value.end(); ssv++) { - putlog(MMLOG_DEBUG, "ssv->name=%s and string_value=%s\n", ssv->name.c_str(), string_value.c_str() ); ssv->selected = (ssv->name == string_value); if (ssv->selected) --- 437,440 ---- |