Permalink
Browse files

fix misimport

  • Loading branch information...
1 parent 0cc98c8 commit bb0b231ddad74bc3ff5f935c7dd9a8087f64d8ed @dragon3 committed Dec 4, 2009
Showing with 5 additions and 56 deletions.
  1. +5 −20 mod_google_analytics.c
  2. +0 −1 mod_google_analytics.h
  3. +0 −6 t/Makefile
  4. +0 −29 t/carrier.c
View
25 mod_google_analytics.c
@@ -46,7 +46,7 @@ limitations under the License.
#include "apr_strmatch.h"
#include "apr_strings.h"
-#include "mod_google_analytics.h"
+#define VERSION "0.2"
static const char *google_analytics_filter_name = "GOOGLE_ANALYTICS";
static const char *body_end_tag = "</body>";
@@ -67,22 +67,6 @@ typedef struct {
apr_bucket_brigade *bbsave;
} google_analytics_filter_ctx;
-static int is_mobile(request_rec *r)
-{
- const char *ua;
- ua = apr_table_get(r->headers_in, "User-Agent");
- if (
- strstr(ua, "DoCoMo") ||
- strstr(ua, "KDDI") ||
- strstr(ua,"J-PHONE") ||
- strstr(ua, "Vodafone") ||
- strstr(ua, "SoftBank")
- ) {
- return 1;
- }
- return 0;
-}
-
static apr_status_t google_analytics_out_filter(ap_filter_t *f, apr_bucket_brigade *bb)
{
request_rec *r = f->r;
@@ -110,7 +94,7 @@ static apr_status_t google_analytics_out_filter(ap_filter_t *f, apr_bucket_briga
apr_bucket_brigade *bbline;
- // do nothing if subrequest.
+ // サブリクエストならなにもしない
if (r->main) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
@@ -123,15 +107,15 @@ static apr_status_t google_analytics_out_filter(ap_filter_t *f, apr_bucket_briga
ctx->bbsave = apr_brigade_create(r->pool, f->c->bucket_alloc);
}
- // OK?
+ // length かわってしまうので unset で OK?
apr_table_unset(r->headers_out, "Content-Length");
apr_table_unset(r->headers_out, "Content-MD5");
apr_table_unset(r->headers_out, "Accept-Ranges");
apr_table_unset(r->headers_out, "ETag");
bbline = apr_brigade_create(r->pool, f->c->bucket_alloc);
- // reorganize buckets per line (break|feed).
+ // 改行毎なbucketに編成しなおす
while ( b != APR_BRIGADE_SENTINEL(bb) ) {
if ( !APR_BUCKET_IS_METADATA(b) ) {
if ( apr_bucket_read(b, &buf, &bytes, APR_BLOCK_READ) == APR_SUCCESS ) {
@@ -200,6 +184,7 @@ static apr_status_t google_analytics_out_filter(ap_filter_t *f, apr_bucket_briga
b = APR_BRIGADE_FIRST(bb);
}
+ // 改行毎なbucketをまわす
for ( b = APR_BRIGADE_FIRST(bbline);
b != APR_BRIGADE_SENTINEL(bbline);
b = APR_BUCKET_NEXT(b) ) {
View
1 mod_google_analytics.h
@@ -1 +0,0 @@
-#define VERSION "0.3"
View
6 t/Makefile
@@ -1,6 +0,0 @@
-#
-
-carrier: carrier.c
- gcc -Wall -g -I../ -o carrier carrier.c
-clean:
- rm -f carrier
View
29 t/carrier.c
@@ -1,29 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "mod_google_analytics.h"
-
-int main(int argc, const char *argv[])
-{
- enum Carrier carrier;
-
- carrier = UNKNOWN;
- fprintf( stdout, "Unknown : %d\n", UNKNOWN );
-
- carrier = DOCOMO;
- fprintf( stdout, "DoCoMo : %d\n", carrier );
-
- carrier = KDDI;
- fprintf( stdout, "Kddi : %d\n", carrier );
-
- carrier = SOFTBANK;
- fprintf( stdout, "SoftBank : %d\n", carrier );
-
- carrier = WILLCOM;
- fprintf( stdout, "Willcom : %d\n", carrier );
-
- exit(0);
-}
-
-
-

0 comments on commit bb0b231

Please sign in to comment.