OSDN Git Service

Merge branch 'branch_0.13.0' into branch_0.13.0-svn
authorkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 10 Apr 2009 00:29:37 +0000 (00:29 +0000)
committerkonn <konn@1a406e8e-add9-4483-a2c8-d8cac5b7c224>
Fri, 10 Apr 2009 00:29:37 +0000 (00:29 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/modchxj/mod_chxj/branches/RELEASE_0_13_0@4742 1a406e8e-add9-4483-a2c8-d8cac5b7c224

include/chxj_serf.h
src/chxj_apply_convrule.c
src/chxj_img_conv_format.c
src/chxj_jhtml.c
src/chxj_jxhtml.c
src/chxj_serf.c
src/mod_chxj.c

index b99984b..5fbc7f7 100644 (file)
@@ -44,6 +44,7 @@ extern char *(*chxj_serf_get)(request_rec *r, apr_pool_t *ppool, const char *url
 
 extern char *default_chxj_serf_post(request_rec *r, apr_pool_t *ppool, const char *url_path, char *post_data, apr_size_t post_data_len, int set_headers_flag, apr_size_t *res_len, int *response_code);
 extern char *(*chxj_serf_post)(request_rec *r, apr_pool_t *ppool, const char *url_path, char *post_data, apr_size_t post_data_len, int set_headers_flag, apr_size_t *res_len, int *response_code);
+extern apr_table_t *(*chxj_serf_head)(request_rec *r, apr_pool_t *ppool, const char *url_path, int *response_code);
 
 
 #endif
index 96d9706..475f448 100644 (file)
@@ -30,7 +30,7 @@ chxj_apply_convrule(request_rec *r, apr_array_header_t *convrules)
   for (ii = 0; ii < convrules->nelts; ii++) {
     pp = &entries[ii];
 
-    if (r->main != NULL) continue;
+    if (r->main) continue;
 
     /* Match */
     if (s_apply_rule(r, pp)) 
index ca394e8..6a4e86a 100644 (file)
@@ -252,14 +252,14 @@ chxj_img_conv_format_handler(request_rec *r)
   if (! r->handler || 
       (r->handler && !STRCASEEQ('c','C',"chxj-picture",r->handler) && !STRCASEEQ('c','C',"chxj-qrcode",r->handler))) {
     DBG(r, "REQ[%X] Response Code:[%d]", (unsigned int)(apr_size_t)r, r->status);
-    DBG(r, "REQ[%X] end chxj_img_conv_format_handler() r->handler is[%s]", (unsigned int)(apr_size_t)r, r->handler);
+    DBG(r, "REQ[%X] end chxj_img_conv_format_handler() r->handler is[%s]", TO_ADDR(r), r->handler);
     return DECLINED;
   }
 
   qsp = s_get_query_string_param(r);
   conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
   if (conf == NULL) {
-    DBG(r, "REQ[%X] end chxj_img_conv_format_handler() conf is null", (unsigned int)(apr_size_t)r);
+    DBG(r, "REQ[%X] end chxj_img_conv_format_handler() conf is null",TO_ADDR(r));
     return DECLINED;
   }
 
@@ -403,7 +403,7 @@ s_img_conv_format_from_file(
   /* Create Workfile Name                                                     */
   /*--------------------------------------------------------------------------*/
   tmpfile = s_create_workfile_name(r, conf, user_agent, qsp);
-  DBG(r,"workfile=[%s]", tmpfile);
+  DBG(r,"REQ[%X] workfile=[%s]", TO_ADDR(r), tmpfile);
 
   rv = apr_stat(&st, r->filename, APR_FINFO_MIN, r->pool);
   if (rv != APR_SUCCESS)
@@ -424,7 +424,7 @@ s_img_conv_format_from_file(
         return rv;
     }
   
-    DBG(r,"color=[%d]", spec->color);
+    DBG(r,"REQ[%X] color=[%d]", TO_ADDR(r), spec->color);
     if (! r->header_only)  {
       rv = s_send_cache_file(spec, qsp,r, tmpfile);
     }
@@ -519,13 +519,13 @@ s_create_cache_file(request_rec          *r,
     readdata = apr_palloc(r->pool, st->size);
     rv = apr_file_read_full(fin, (void*)readdata, st->size, &readbyte);
     if (rv != APR_SUCCESS || readbyte != st->size) {
-      DBG(r,"file read failed.[%s]", r->filename);
+      DBG(r,"REQ[%X] file read failed.[%s]", TO_ADDR(r), r->filename);
       apr_file_close(fin);
   
       return HTTP_NOT_FOUND;
     }
   }
-  DBG(r,"start img convert");
+  DBG(r,"REQ[%X] start img convert", TO_ADDR(r));
 
 
   magick_wand = NewMagickWand();
@@ -566,7 +566,7 @@ s_create_cache_file(request_rec          *r,
       /*
        * The size of the image is changed.
        */
-      DBG(r,"call s_fixup_size()");
+      DBG(r,"REQ[%X] call s_fixup_size()", TO_ADDR(r));
   
       if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) 
         return HTTP_NOT_FOUND;
@@ -576,7 +576,7 @@ s_create_cache_file(request_rec          *r,
     /*
      * The colors of the image is changed.
      */
-    DBG(r,"call s_fixup_color()");
+    DBG(r,"REQ[%X] call s_fixup_color()", TO_ADDR(r));
   
     if ((magick_wand = s_fixup_color(magick_wand, r,spec, mode)) == NULL) 
       return HTTP_NOT_FOUND;
@@ -584,7 +584,7 @@ s_create_cache_file(request_rec          *r,
     /*
      * DEPTH of the image is changed.
      */
-    DBG(r,"call s_fixup_depth()");
+    DBG(r,"REQ[%X] call s_fixup_depth()", TO_ADDR(r));
   
     if ((magick_wand = s_fixup_depth(magick_wand, r, spec)) == NULL) 
       return HTTP_NOT_FOUND;
@@ -594,7 +594,7 @@ s_create_cache_file(request_rec          *r,
       /*
        * The size of the image is changed.
        */
-      DBG(r,"call s_fixup_size()");
+      DBG(r,"REQ[%X] call s_fixup_size()", TO_ADDR(r));
       if ((magick_wand = s_fixup_size(magick_wand, r, spec, qsp)) == NULL) 
         return HTTP_NOT_FOUND;
     }
@@ -626,9 +626,17 @@ s_create_cache_file(request_rec          *r,
           fixFormatFlag = 1;
         }
       }
+      else if (STRCASEEQ('b','B',"bmp",nowFormat)) {
+        if (spec->available_bmp4 || spec->available_bmp2) {
+          if (s_convert_to_bmp(magick_wand, r, spec)) {
+            return HTTP_NOT_FOUND;
+          }
+          fixFormatFlag = 1;
+        }
+      }
     }
 
-    DBG(r,"start convert and compression");
+    DBG(r,"REQ[%X] start convert and compression", TO_ADDR(r));
   
     if (! fixFormatFlag) {
       if (spec->available_jpeg) {
@@ -1586,22 +1594,23 @@ s_img_down_sizing(MagickWand *magick_wand, request_rec *r, device_table *spec)
 
 
 static apr_status_t 
-s_send_cache_file(device_table *UNUSED(spec), query_string_param_t *query_string, request_rec *r, const char *tmpfile)
+s_send_cache_file(device_table *spec, query_string_param_t *query_string, request_rec *r, const char *tmpfile)
 {
   apr_status_t rv;
   apr_finfo_t  st;
   apr_file_t   *fout;
   apr_size_t   sendbyte;
   char         *contentLength;
+  mod_chxj_config *conf = ap_get_module_config(r->per_dir_config, &chxj_module);
 
   rv = apr_stat(&st, tmpfile, APR_FINFO_MIN, r->pool);
   if (rv != APR_SUCCESS)
     return HTTP_NOT_FOUND;
 
-  DBG(r, "mode:[%d]",    query_string->mode);
-  DBG(r, "name:[%s]",    query_string->name);
-  DBG(r, "offset:[%ld]", query_string->offset);
-  DBG(r, "count:[%ld]",  query_string->count);
+  DBG(r, "REQ[%X] mode:[%d]",    TO_ADDR(r), query_string->mode);
+  DBG(r, "REQ[%X] name:[%s]",    TO_ADDR(r), query_string->name);
+  DBG(r, "REQ[%X] offset:[%ld]", TO_ADDR(r), query_string->offset);
+  DBG(r, "REQ[%X] count:[%ld]",  TO_ADDR(r), query_string->count);
 
   if (query_string->mode != IMG_CONV_MODE_EZGET && query_string->name == NULL) {
     contentLength = apr_psprintf(r->pool, "%d", (int)st.size);
@@ -1642,6 +1651,12 @@ s_send_cache_file(device_table *UNUSED(spec), query_string_param_t *query_string
         return HTTP_NOT_FOUND;
       }
     }
+    if (conf->image_copyright) {
+      DBG(r, "REQ[%X] Add COPYRIGHT Header for SoftBank [%s]", TO_ADDR(r), conf->image_copyright);
+      if (spec->html_spec_type == CHXJ_SPEC_Jhtml ||  spec->html_spec_type == CHXJ_SPEC_Jxhtml) {
+        apr_table_setn(r->headers_out, "x-jphone-copyright", "no-transfer");
+      }
+    }
     rv = apr_file_open(&fout, tmpfile, 
       APR_READ | APR_BINARY, APR_OS_DEFAULT, r->pool);
     if (rv != APR_SUCCESS) {
@@ -1651,7 +1666,7 @@ s_send_cache_file(device_table *UNUSED(spec), query_string_param_t *query_string
     ap_send_fd(fout, r, 0, st.size, &sendbyte);
     apr_file_close(fout);
     ap_rflush(r);
-    DBG(r, "send file data[%d]byte", (int)sendbyte);
+    DBG(r, "REQ[%X] send file data[%d]byte", TO_ADDR(r), (int)sendbyte);
   }
   else
   if (query_string->mode == IMG_CONV_MODE_EZGET) {
@@ -1746,20 +1761,25 @@ s_send_original_file(request_rec *r, const char *originalfile)
 
 
 static apr_status_t 
-s_header_only_cache_file(device_table *UNUSED(spec), query_string_param_t *query_string, request_rec *r, const char *tmpfile)
+s_header_only_cache_file(device_table *spec, query_string_param_t *query_string, request_rec *r, const char *tmpfile)
 {
   apr_status_t rv;
   apr_finfo_t  st;
   char         *contentLength;
+  mod_chxj_config *conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+
+  DBG(r, "REQ[%X] start s_header_only_cache_file()", TO_ADDR(r));
 
   rv = apr_stat(&st, tmpfile, APR_FINFO_MIN, r->pool);
-  if (rv != APR_SUCCESS)
+  if (rv != APR_SUCCESS) {
+    DBG(r, "REQ[%X] end s_header_only_cache_file()", TO_ADDR(r));
     return HTTP_NOT_FOUND;
+  }
 
-  DBG(r, "mode:[%d]",    query_string->mode);
-  DBG(r, "name:[%s]",    query_string->name);
-  DBG(r, "offset:[%ld]", query_string->offset);
-  DBG(r, "count:[%ld]",  query_string->count);
+  DBG(r, "REQ[%X] mode:[%d]",    TO_ADDR(r), query_string->mode);
+  DBG(r, "REQ[%X] name:[%s]",    TO_ADDR(r), query_string->name);
+  DBG(r, "REQ[%X] offset:[%ld]", TO_ADDR(r), query_string->offset);
+  DBG(r, "REQ[%X] count:[%ld]",  TO_ADDR(r), query_string->count);
 
   if (query_string->mode != IMG_CONV_MODE_EZGET && query_string->name == NULL) {
     contentLength = apr_psprintf(r->pool, "%d", (int)st.size);
@@ -1795,7 +1815,7 @@ s_header_only_cache_file(device_table *UNUSED(spec), query_string_param_t *query
         ap_set_content_type(r, "image/bmp");
       }
       else {
-        ERR(r, "detect unknown file");
+        ERR(r, "REQ[%X] detect unknown file", TO_ADDR(r));
         return HTTP_NOT_FOUND;
       }
     }
@@ -1837,10 +1857,17 @@ s_header_only_cache_file(device_table *UNUSED(spec), query_string_param_t *query
       contentLength = apr_psprintf(r->pool, "%ld", query_string->count);
       apr_table_setn(r->headers_out, "Content-Length", (const char*)contentLength);
   
-      DBG(r, "Content-Length:[%d]", (int)st.size);
+      DBG(r, "REQ[%X] Content-Length:[%d]", TO_ADDR(r), (int)st.size);
+    }
+  }
+  if (conf->image_copyright) {
+    DBG(r, "REQ[%X] Add COPYRIGHT Header for SoftBank [%s]", TO_ADDR(r), conf->image_copyright);
+    if (spec->html_spec_type == CHXJ_SPEC_Jhtml ||  spec->html_spec_type == CHXJ_SPEC_Jxhtml) {
+      apr_table_setn(r->headers_out, "x-jphone-copyright", "no-transfer");
     }
   }
   
+  DBG(r, "REQ[%X] end s_header_only_cache_file()", TO_ADDR(r));
   return OK;
 }
 
index 666500b..096acce 100644 (file)
@@ -24,6 +24,7 @@
 #include "chxj_str_util.h"
 #include "chxj_header_inf.h"
 #include "chxj_jreserved_tag.h"
+#include "chxj_serf.h"
 
 
 #define GET_JHTML(X) ((jhtml_t *)(X))
@@ -132,6 +133,7 @@ static char *chxj_istyle_to_mode(apr_pool_t *p, const char *s);
 static css_prop_list_t *s_jhtml_push_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
 static css_prop_list_t *s_jhtml_nopush_and_get_now_style(void *pdoc, Node *node, const char *style_attr_value);
 
+static char *s_add_copyright_parameter(request_rec *r, char *value);
 
 
 tag_handler jhtml_handler[] = {
@@ -2703,6 +2705,7 @@ s_jhtml_start_img_tag(void *pdoc, Node *node)
       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
       value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
       value = chxj_add_cookie_no_update_parameter(r, value);
+      value = s_add_copyright_parameter(r, value);
       attr_src = value;
 #else
       value = chxj_img_conv(r, spec, value);
@@ -2710,6 +2713,7 @@ s_jhtml_start_img_tag(void *pdoc, Node *node)
       value = chxj_jreserved_tag_to_safe_for_query_string(r, value, jhtml->entryp, 0);
       value = chxj_add_cookie_parameter(r, value, jhtml->cookie);
       value = chxj_add_cookie_no_update_parameter(r, value);
+      value = s_add_copyright_parameter(r, value);
       attr_src = value;
 #endif
       }
@@ -5557,6 +5561,72 @@ s_jhtml_style_tag(void *pdoc, Node *node)
   }
   return jhtml->out;
 }
+
+static char *
+s_add_copyright_parameter(request_rec *r, char *value)
+{
+  request_rec *sub_req = NULL;
+  apr_pool_t *pool;
+  int rr_status;
+  char *content_type = NULL;
+  apr_table_t *headers_out = NULL;
+
+  DBG(r, "REQ[%X] start s_add_copyright_parameter", TO_ADDR(r));
+  apr_pool_create(&pool, r->pool);
+
+  if (chxj_starts_with(value, "http:") || chxj_starts_with(value, "https:")) {
+    apr_table_t *response;
+    int   response_code = 0;
+    response = chxj_serf_head(r, pool, value, &response_code);
+    if (response_code != HTTP_OK) {
+      DBG(r, "REQ[%X] end s_add_copyright_parameter (serf_req->status:[%d])", TO_ADDR(r), response_code);
+      return value;
+    }
+    content_type = (char *)apr_table_get(response, "Content-Type");
+    headers_out = response;
+  }
+  else {
+    //  sub_req = ap_sub_req_method_uri("GET", value, r, r->output_filters);
+    sub_req = ap_sub_req_lookup_uri(value, r, r->output_filters);
+    if (sub_req->status != HTTP_OK) {
+      DBG(r, "REQ[%X] end s_add_copyright_parameter (sub_req->status:[%d])", TO_ADDR(r), sub_req->status);
+      ap_destroy_sub_req(sub_req);
+      return value;
+    }
+    sub_req->header_only = 1;
+    sub_req->main = NULL;
+    rr_status = ap_run_sub_req(sub_req);
+    DBG(r, "REQ[%X] sub_req4:ContentType:[%s]", TO_ADDR(r), sub_req->content_type);
+    DBG(r, "REQ[%X] rr_status:[%d]", TO_ADDR(r), rr_status);
+    content_type = apr_pstrdup(pool, sub_req->content_type);
+    headers_out = sub_req->headers_out;
+  }
+  if (headers_out && apr_table_get(headers_out, "x-jphone-copyright")) {
+    if (content_type && strncasecmp("image/jpeg", content_type, 10) == 0) {
+      if (strchr(value, '?')) {
+        value = apr_psprintf(pool, "%s&_chxj_copy=.jpz", value);
+      }
+      else {
+        value = apr_psprintf(pool, "%s?_chxj_copy=.jpz", value);
+      }
+    }
+    else if (content_type && strncasecmp("image/png", content_type, 9) == 0) {
+      if (strchr(value, '?')) {
+        value = apr_psprintf(pool, "%s&_chxj_copy=.pnz", value);
+      }
+      else {
+        value = apr_psprintf(pool, "%s?_chxj_copy=.pnz", value);
+      }
+    }
+  }
+  if (sub_req) {
+    ap_destroy_sub_req(sub_req);
+  }
+  DBG(r, "REQ[%X] end s_add_copyright_parameter(result:[%s]", TO_ADDR(r), value);
+  return value;
+}
+
+
 /*
  * vim:ts=2 et
  */
index 13ec12f..1259c48 100644 (file)
@@ -483,7 +483,7 @@ chxj_convert_jxhtml(
 
   chxj_buffered_write_init(r->pool, &doc.buf);
   /*--------------------------------------------------------------------------*/
-  /* It converts it from CHTML to JXHTML.                                      */
+  /* It converts it from CHTML to JXHTML.                                     */
   /*--------------------------------------------------------------------------*/
   chxj_node_convert(spec,r,(void*)&jxhtml, &doc, qs_get_root(&doc), 0);
   jxhtml.out = chxj_buffered_write_flush(jxhtml.out, &doc.buf);
@@ -682,7 +682,7 @@ s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
   jxhtml  = GET_JXHTML(pdoc);
   doc    = jxhtml->doc;
   r      = doc->r;
-  DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", (unsigned int)(apr_size_t)r);
+  DBG(r, "REQ[%X] start s_jxhtml_start_html_tag()", TO_ADDR(r));
 
   W_L("<?xml version=\"1.0\" encoding=\"Shift_JIS\" ?>");
   W_NLCODE();
@@ -696,7 +696,7 @@ s_jxhtml_start_html_tag(void *pdoc, Node *UNUSED(node))
 
   jxhtml->start_html_flag = 1;
 
-  DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", (unsigned int)(apr_size_t)r);
+  DBG(r, "REQ[%X] end s_jxhtml_start_html_tag()", TO_ADDR(r));
 
   return jxhtml->out;
 }
index 3512601..67582cd 100644 (file)
@@ -61,6 +61,8 @@ char *default_chxj_serf_get(request_rec *r, apr_pool_t *ppool, const char *url_p
 char *(*chxj_serf_get)(request_rec *r, apr_pool_t *ppool, const char *url_path, int set_headers_flag, apr_size_t *response_len) = default_chxj_serf_get;
 char *default_chxj_serf_post(request_rec *r, apr_pool_t *ppool, const char *url_path, char *post_data, apr_size_t post_data_len, int set_headers_flag, apr_size_t *response_len, int *response_code);
 char *(*chxj_serf_post)(request_rec *r, apr_pool_t *ppool, const char *url_path, char *post_data, apr_size_t post_data_len, int set_headers_flag, apr_size_t *response_len, int *response_code) = default_chxj_serf_post;
+apr_table_t *default_chxj_serf_head(request_rec *r, apr_pool_t *ppool, const char *url_path, int *response_code);
+apr_table_t *(*chxj_serf_head)(request_rec *r, apr_pool_t *ppool, const char *url_path, int *response_code) = default_chxj_serf_head;
 
 
 void
@@ -496,6 +498,118 @@ default_chxj_serf_post(request_rec *r, apr_pool_t *ppool, const char *url_path,
   DBG(r, "REQ:[%X] end chxj_serf_post()", (unsigned int)(apr_size_t)r);
   return ret;
 }
+
+
+apr_table_t *
+default_chxj_serf_head(request_rec *r, apr_pool_t *ppool, const char *url_path, int *response_code)
+{
+  apr_pool_t *pool;
+  apr_uri_t url;
+  apr_status_t rv;
+  apr_sockaddr_t *address = NULL;
+
+  serf_context_t *context;
+  serf_connection_t *connection;
+
+  app_ctx_t app_ctx;
+  handler_ctx_t handler_ctx;
+  char *ret;
+
+  DBG(r, "REQ:[%X] start chxj_serf_head()", (unsigned int)(apr_size_t)r);
+
+
+  s_init(ppool, &pool);
+
+  apr_uri_parse(pool, url_path, &url);
+  if (!url.port) {
+    url.port = apr_uri_port_of_scheme(url.scheme);
+  }
+  if (!url.port) {
+    url.port = 80;
+  }
+  if (!url.path) {
+    url.path = "/";
+  }
+  if (!url.hostname) {
+    url.hostname = "localhost";
+  }
+  if (url.query) {
+    url.path = apr_psprintf(pool, "%s?%s", url.path, url.query);
+  }
+
+  rv = apr_sockaddr_info_get(&address, url.hostname, APR_UNSPEC, url.port, 0, pool);
+  if (rv != APR_SUCCESS) {
+    char buf[256];
+    ERR(r, "apr_sockaddr_info_get() failed: rv:[%d|%s]", rv, apr_strerror(rv, buf, 256));
+    return NULL;
+  }
+  memset(&app_ctx, 0, sizeof(app_ctx_t));
+
+  app_ctx.bkt_alloc = serf_bucket_allocator_create(pool, NULL, NULL);
+  if (strcasecmp(url.scheme, "https") == 0) {
+    app_ctx.ssl_flag = 1;
+  }
+
+  context = serf_context_create(pool);
+  connection = serf_connection_create(context, address, s_connection_setup, &app_ctx, s_connection_closed, &app_ctx, pool);
+
+  memset(&handler_ctx, 0, sizeof(handler_ctx_t));
+  handler_ctx.requests_outstanding = 0;
+  handler_ctx.host = url.hostinfo;
+  /*========================================================================================================*/
+  /* XXX Maybe, libserf doesn't support the HEAD request. Because the part body is waited for with polling. */
+  /*========================================================================================================*/
+  handler_ctx.method = "GET";
+  handler_ctx.path = url.path;
+  handler_ctx.user_agent = (char *)apr_table_get(r->headers_in, CHXJ_HTTP_USER_AGENT);
+  if (! handler_ctx.user_agent) {
+    handler_ctx.user_agent = (char *)apr_table_get(r->headers_in, HTTP_USER_AGENT);
+  }
+  handler_ctx.post_data     = NULL;
+  handler_ctx.post_data_len = 0;
+
+  handler_ctx.acceptor     = s_accept_response;
+  handler_ctx.acceptor_ctx = &app_ctx;
+  handler_ctx.handler      = s_handle_response;
+  handler_ctx.pool         = pool;
+  handler_ctx.r            = r;
+  handler_ctx.response_len = 0;
+  handler_ctx.response     = NULL;
+
+  serf_connection_request_create(connection, s_setup_request, &handler_ctx);
+
+  while (1) {
+    rv = serf_context_run(context, SERF_DURATION_FOREVER, pool);
+    if (APR_STATUS_IS_TIMEUP(rv))
+      continue;
+    if (rv) {
+      char buf[200];
+      ERR(r, "Error running context: (%d) %s\n", rv, apr_strerror(rv, buf, sizeof(buf)));
+      break;
+    }
+    if (!apr_atomic_read32(&handler_ctx.requests_outstanding)) {
+      if (handler_ctx.rv != APR_SUCCESS) {
+        char buf[200];
+        ERR(r, "Error running context: (%d) %s\n", handler_ctx.rv, apr_strerror(handler_ctx.rv, buf, sizeof(buf)));
+      }
+      break;
+    }
+  }
+
+  DBG(r, "end of serf request");
+  DBG(r, "response_code:[%d]", handler_ctx.response_code);
+  DBG(r, "response:[%s][%" APR_SIZE_T_FMT "]", handler_ctx.response, handler_ctx.response_len);
+  serf_connection_close(connection);
+  if (handler_ctx.response) {
+    ret = apr_pstrdup(ppool, handler_ctx.response);
+  }
+  else {
+    ret = apr_pstrdup(ppool, "");
+  }
+  *response_code = handler_ctx.response_code;
+  DBG(r, "REQ:[%X] end chxj_serf_post()", (unsigned int)(apr_size_t)r);
+  return handler_ctx.headers_out;
+}
 /*
  * vim:ts=2 et
  */
index f5f99b4..19f3633 100644 (file)
@@ -1552,6 +1552,7 @@ chxj_translate_name(request_rec *r)
   DBG(r, "REQ[%X] =======================================================================", (unsigned int)(apr_size_t)r);
   DBG(r, "REQ[%X] ", (unsigned int)(apr_size_t)r);
   DBG(r, "REQ[%X] START REQUEST (uri:[%s] args:[%s])", (unsigned int)(apr_size_t)r, r->unparsed_uri, r->args ? r->args : "");
+  DBG(r, "REQ[%X] METHOD [%s]", TO_ADDR(r), r->method);
   DBG(r, "REQ[%X] ", (unsigned int)(apr_size_t)r);
   DBG(r, "REQ[%X] =======================================================================", (unsigned int)(apr_size_t)r);
 #if 0