By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

Error in Apache module...

P: n/a
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!

Jun 19 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
vi****************@gmail.com wrote:
>
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?
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
Jun 19 '07 #2

P: n/a
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:
vi****************@gmail.com wrote:

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?
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
Jun 20 '07 #3

P: n/a
On Wed, 20 Jun 2007 03:21:28 -0700, in comp.lang.c ,
vi****************@gmail.com wrote:
>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?
>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?
>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
Jun 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.