<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -78,7 +78,9 @@ static int reportuploads_handler(request_rec *r);
 upload_progress_node_t* insert_node(request_rec *r, const char *key);
 upload_progress_node_t *store_node(ServerConfig *config, const char *key);
 upload_progress_node_t *find_node(request_rec *r, const char *key);
-int add_upload_to_track(request_rec* r, const char* id);
+static void clean_old_connections(request_rec *r);
+void fill_new_upload_node_data(upload_progress_node_t *node, request_rec *r);
+static apr_status_t upload_progress_cleanup(void *data);
 const char *get_progress_id(request_rec *r);
 static const char *track_upload_progress_cmd(cmd_parms *cmd, void *dummy, int arg);
 static const char *report_upload_progress_cmd(cmd_parms *cmd, void *dummy, int arg);
@@ -134,25 +136,38 @@ static int upload_progress_handle_request(request_rec *r)
   DirConfig* dir = (DirConfig*)ap_get_module_config(r-&gt;per_dir_config, &amp;upload_progress_module);
   ServerConfig *config = get_server_config(r);
   
-  if(dir-&gt;track_enabled) {
-    if(r-&gt;method_number == M_POST) {
+  if (dir-&gt;track_enabled) {
+    if (r-&gt;method_number == M_POST) {
       ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-&gt;server,
                          &quot;Upload Progress: Upload in trackable location: %s.&quot;, r-&gt;uri);
       const char* id = get_progress_id(r);
-      if(id != NULL) {
+      if (id != NULL) {
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-&gt;server,
                          &quot;Upload Progress: Progress id found: %s.&quot;, id);
         CACHE_LOCK();
+        clean_old_connections(r);
         upload_progress_node_t *node = find_node(r, id);
         if (node == NULL) {
-          add_upload_to_track(r, id);
-          ap_add_input_filter(&quot;UPLOAD_PROGRESS&quot;, NULL, r, r-&gt;connection);
-	} else {
+          node = insert_node(r, id);
+          if (node)
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-&gt;server,
+                         &quot;Upload Progress: Added upload with id=%s to list.&quot;, id);
+        } else if (node-&gt;done) {
+          fill_new_upload_node_data(node, r);
           ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-&gt;server,
-                         &quot;Upload Progress: Node with id '%s' already exists.&quot;, id);
+                         &quot;Upload Progress: Reused existing node with id '%s'.&quot;, id);
+        } else {
+          node = NULL;
+        }
+
+        if (node) {
+          upload_progress_context_t *ctx = (upload_progress_context_t*)apr_pcalloc(r-&gt;pool, sizeof(upload_progress_context_t));
+          ctx-&gt;node = node;
+          ctx-&gt;r = r;
+          apr_pool_cleanup_register(r-&gt;pool, ctx, upload_progress_cleanup, apr_pool_cleanup_null);
+          ap_add_input_filter(&quot;UPLOAD_PROGRESS&quot;, NULL, r, r-&gt;connection);
 	}
 	CACHE_UNLOCK();
-        return DECLINED;
       }
     }
   }
@@ -489,27 +504,6 @@ static void clean_old_connections(request_rec *r) {
     }
 }
 
-int add_upload_to_track(request_rec* r, const char* key) {
-  ServerConfig *config = get_server_config(r);
-  upload_progress_node_t* node;
-
-  clean_old_connections(r);
-
-  node = find_node(r, key);
-  if (node == NULL) {
-    node = insert_node(r, key);
-    if (node == NULL)
-      return OK;
-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r-&gt;server,
-                         &quot;Upload Progress: Added upload with id=%s to list.&quot;, key);
-    upload_progress_context_t *ctx = (upload_progress_context_t*)apr_pcalloc(r-&gt;pool, sizeof(upload_progress_context_t));
-    ctx-&gt;node = node;
-    ctx-&gt;r = r;
-    apr_pool_cleanup_register(r-&gt;pool, ctx, upload_progress_cleanup, apr_pool_cleanup_null);
-  }
-  return OK;
-}
-
 void upload_progress_destroy_cache(ServerConfig *config) {
     upload_progress_cache_t *cache = fetch_cache(config);
     upload_progress_node_t *node, *temp;</diff>
      <filename>mod_upload_progress.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5ba7d25027c1a987832b4f5f7e03a9a51d860d61</id>
    </parent>
  </parents>
  <author>
    <name>Micha&#322; Pokrywka</name>
    <email>michal.pokrywka@gmail.com</email>
  </author>
  <url>http://github.com/drogus/apache-upload-progress-module/commit/eb87ac0b871857202b058563f107c97dc13d68d8</url>
  <id>eb87ac0b871857202b058563f107c97dc13d68d8</id>
  <committed-date>2009-05-21T16:24:57-07:00</committed-date>
  <authored-date>2009-05-21T15:52:45-07:00</authored-date>
  <message>Allow reusing nodes of finished requests with same progress id
This feature allows retrying e.g. failed upload with same progress id
before 60 second expiration timeout</message>
  <tree>25597889c17bd25b7d8bd3ee2ad0d7302a3f2160</tree>
  <committer>
    <name>Micha&#322; Pokrywka</name>
    <email>michal.pokrywka@gmail.com</email>
  </committer>
</commit>
