Connecting Tech Pros Worldwide Forums | Help | Site Map

Error in Apache module...

vincenzo.bacarella@gmail.com
Guest
 
Posts: n/a
#1: Jun 19 '07
Hi,

we are trying to create an apache module which catch web requests and
does evaluation of the content_type string.

Here a snippet:

.....
char *type = ap_table_get(r->headers_in, "Content-Type");
char *posizione = strstr(type,"html");
.....

....but when we evaluate posizione....

if (posizione == NULL) return OK;

I get a blank page with header RESPONSE: HTTP/0.9 200 OK - probably
there is a runtime error. I am a newbie in Apache Modules, please let
me know where is the error.

Thanks!


pete
Guest
 
Posts: n/a
#2: Jun 19 '07

re: Error in Apache module...


vincenzo.bacarella@gmail.com wrote:
Quote:
>
Hi,
>
we are trying to create an apache module which catch web requests and
does evaluation of the content_type string.
>
Here a snippet:
>
....
char *type = ap_table_get(r->headers_in, "Content-Type");
Does (type) point to a string at this point in code?
Quote:
char *posizione = strstr(type,"html");
....
>
...but when we evaluate posizione....
>
if (posizione == NULL) return OK;
>
I get a blank page with header RESPONSE: HTTP/0.9 200 OK - probably
there is a runtime error. I am a newbie in Apache Modules, please let
me know where is the error.
--
pete
vincenzo.bacarella@gmail.com
Guest
 
Posts: n/a
#3: Jun 20 '07

re: Error in Apache module...


Yes, "type" points to a string, but we don't understand because there
is a runtime error when we evaluate "posizione".

The runtime error give us in output a blank web page bacause this sw
is an Apache Module.


Any idea?

pete ha scritto:
Quote:
vincenzo.bacarella@gmail.com wrote:
Quote:

Hi,

we are trying to create an apache module which catch web requests and
does evaluation of the content_type string.

Here a snippet:

....
char *type = ap_table_get(r->headers_in, "Content-Type");
>
Does (type) point to a string at this point in code?
>
Quote:
char *posizione = strstr(type,"html");
....

...but when we evaluate posizione....

if (posizione == NULL) return OK;

I get a blank page with header RESPONSE: HTTP/0.9 200 OK - probably
there is a runtime error. I am a newbie in Apache Modules, please let
me know where is the error.
>
--
pete
Mark McIntyre
Guest
 
Posts: n/a
#4: Jun 20 '07

re: Error in Apache module...


On Wed, 20 Jun 2007 03:21:28 -0700, in comp.lang.c ,
vincenzo.bacarella@gmail.com wrote:
Quote:
>Yes, "type" points to a string,
So during the execution of the code, you are sure that at the point
which pete marked, 'type' is really pointing to a valid string, and
not to garbage or null or something? Can you printf the string to
console or into a file or something?
Quote:
>but we don't understand because there
>is a runtime error when we evaluate "posizione".
'type' is not pointing to a string which contains the letters
'html',and so posizione is null?
Quote:
>The runtime error
are you actually getting an error or is this just your guess as to
what is wrong?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Closed Thread