chxj_headers_fixup(request_rec *r)
{
mod_chxj_config* dconf;
+ mod_chxj_req_config *request_conf;
chxjconvrule_entry* entryp;
char* user_agent;
device_table* spec;
return DECLINED;
}
+ request_conf = (mod_chxj_req_config *)chxj_get_module_config(r->request_config, &chxj_module);
+ if (!request_conf) {
+ request_conf = apr_palloc(r->pool, sizeof(mod_chxj_req_config));
+ request_conf->spec = NULL;
+ request_conf->user_agent = NULL;
+ chxj_set_module_config(r->request_config, &chxj_module, request_conf);
+ }
dconf = chxj_get_module_config(r->per_dir_config, &chxj_module);
user_agent = (char*)apr_table_get(r->headers_in, HTTP_USER_AGENT);
+
+ /*
+ * check and get mobile type.
+ * and request_conf->user_agent , request_conf->spec is set.
+ */
spec = chxj_specified_device(r, user_agent);
contentType = (char *)apr_table_get(r->headers_in, "Content-Type");
if (r->method_number == M_POST) {
if (! apr_table_get(r->headers_in, "X-Chxj-Forward")) {
- DBG(r, "REQ[%X] set Input handler old:[%s] proxyreq:[%d] uri:[%s] filename:[%s]", TO_ADDR(r), r->handler, r->proxyreq, r->uri, r->filename);
- r->proxyreq = PROXYREQ_NONE;
- r->handler = apr_psprintf(r->pool, "chxj-input-handler");
+ DBG(r, "REQ[%X] set Input handler old:[%s] proxyreq:[%d] uri:[%s] filename:[%s]", TO_ADDR(r), r->handler, r->proxyreq, r->uri, r->filename);
+ r->proxyreq = PROXYREQ_NONE;
+ r->handler = apr_psprintf(r->pool, "chxj-input-handler");
}
else {
char *client_ip = (char *)apr_table_get(r->headers_in, CHXJ_HEADER_ORIG_CLIENT_IP);
s_add_no_cache_headers(r, entryp);
/* must not send body. */
rv = pass_data_to_filter(f, "", 0);
- chxj_specified_cleanup(r);
DBG(f->r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
return rv;
}
s_add_no_cache_headers(r, entryp);
ap_pass_brigade(f->next, bb);
DBG(f->r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
- chxj_specified_cleanup(r);
return APR_SUCCESS;
}
}
else {
DBG(r, "REQ[%X] not convert content-type:[(null)]", TO_ADDR(r));
ap_pass_brigade(f->next, bb);
- chxj_specified_cleanup(r);
- DBG(f->r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
+ DBG(f->r, "REQ[%X] end %s()", TO_ADDR(f->r),__func__);
return APR_SUCCESS;
}
if (sts != OK) {
ERR(r, "REQ[%X] qrcode create failed.", TO_ADDR(r));
chxj_cookie_unlock(r, lock);
- chxj_specified_cleanup(r);
DBG(f->r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
return sts;
}
(const char *)ctx->buffer,
(apr_size_t)ctx->len);
}
- chxj_specified_cleanup(r);
DBG(f->r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
return rv;
}
apr_table_setn(r->headers_out, "Content-Length", "0");
s_add_no_cache_headers(r, entryp);
rv = pass_data_to_filter(f, (const char *)"", (apr_size_t)0);
- chxj_specified_cleanup(r);
return rv;
}
}
}
apr_brigade_destroy(bb);
- chxj_specified_cleanup(r);
DBG(r, "REQ[%X] end %s()", TO_ADDR(r),__func__);
return APR_SUCCESS;
apr_table_unset(r->headers_in, "Content-Length");
apr_table_setn(r->headers_in, "Content-Length", apr_psprintf(pool, "%" APR_SIZE_T_FMT, post_data_len));
response = chxj_serf_post(r, pool, url_path, post_data, post_data_len, 1, &res_len, &response_code);
-#if 0
- DBG(r, "REQ[%X] -------------------------------------------------------", TO_ADDR(r));
- DBG(r, "REQ[%X] response length:[%" APR_SIZE_T_FMT "]", (unsigned int)(apr_size_t)r, res_len);
- for (ii=0; ii<res_len/64; ii++) {
- DBG(r, "REQ[%X] response:[%.*s]", TO_ADDR(r), 64, &response[ii*64]);
- }
- DBG(r, "REQ[%X] -------------------------------------------------------", TO_ADDR(r));
-#endif
char *chunked;
if ((chunked = (char *)apr_table_get(r->headers_out, "Transfer-Encoding")) != NULL) {