Problems with NSAPI function netbuf_getc() or netbuf_getbytes
I am developing a custom SAF using NSAPI,
Sun One Webserver 6.1 SP6 and I use the Sun Java Reverse Proxy Plug-in SP3.
The webserver is deployed on the Red Hat Linux Operating System.
I do some custom authorization and override some http requests coming to the sun one webserver and I execute my function and I either proceed the request or deny it. If I proceed the request. I use the passthrough liberary of sun which is the reverse proxy plugin to redirect the request to the actual server containing the requested service..
My magnus.conf is like this
Init fn="load-modules" shlib="/opt/SUNWwbsvr/plugins/passthrough/libpassthrough.so" funcs="init-passthrough,service-passthrough" Thread="no"
Init fn="init-passthrough"
Init fn="load-modules" shlib="/opt/SUNWwbsvr/plugins/nsapi/examples/Ahmed_MyAuth.so" funcs="hardcoded_auth,init_error_page,init_logout_uri,logoff_user,test_fn,test_ fn2"
My C Custom SAF is the one Ahmed_MyAuth.so file. the authorization function I use is the hardcoded_auth function.
My obj.conf file is like this:
<Object name="default">
AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
#AuthTrans fn="basic-auth" fn="hardcoded_auth"
NameTrans fn="assign-name" from="(/CBPS/*)" name="CBPS"
NameTrans fn="assign-name" from="(/DVRS/*)" name="DVRS"
NameTrans fn="assign-name" from="(/HCVC/*)" name="HCVC"
NameTrans fn="assign-name" from="(/eFormServerWebUI/WebUI/*)" name="RC"
NameTrans fn="assign-name" from="(/ECLINIC/*)" name="ECLINIC"
NameTrans fn="assign-name" from="(/logoff/*)" name="LOGOFF"
NameTrans fn="ntrans-j2ee" name="j2ee"
NameTrans fn=pfx2dir from=/mc-icons dir="/opt/SUNWwbsvr/ns-icons" name="es-internal"
NameTrans fn=document-root root="$docroot"
PathCheck fn=unix-uri-clean
PathCheck fn="check-acl" acl="default"
PathCheck fn=find-pathinfo
PathCheck fn=find-index index-names="index.html,home.html,index.jsp"
ObjectType fn=type-by-extension
ObjectType fn=force-type type=text/plain
Service method=(GET|HEAD) type=magnus-internal/imagemap fn=imagemap
Service method=(GET|HEAD) type=magnus-internal/directory fn=index-common
Service method=(GET|HEAD|POST) type=*~magnus-internal/* fn=send-file
Service method=TRACE fn=service-trace
Error fn="error-j2ee"
AddLog fn=flex-log name="access"
</Object>
<Object name="j2ee">
Service fn="service-j2ee" method="*"
</Object>
<Object name="cgi">
ObjectType fn=force-type type=magnus-internal/cgi
Service fn=send-cgi user="$user" group="$group" chroot="$chroot" dir="$dir" nice="$nice"
</Object>
<Object name="es-internal">
PathCheck fn="check-acl" acl="es-internal"
</Object>
<Object name="send-compressed">
PathCheck fn="find-compressed"
</Object>
<Object name="compress-on-demand">
Output fn="insert-filter" filter="http-compression"
</Object>
<Object name="CBPS">
PathCheck fn="hardcoded_auth"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" method="(GET|HEAD|POST)" servers="http://172.16.5.53:8080"
</Object>
<Object name="DVRS">
PathCheck fn="hardcoded_auth"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" method="(GET|HEAD|POST)" servers="http://172.16.5.53:8080"
</Object>
<Object name="HCVC">
PathCheck fn="hardcoded_auth"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" method="(GET|HEAD|POST)" servers="http://172.16.5.53:8080"
</Object>
<Object name="RC">
PathCheck fn="hardcoded_auth"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" method="(GET|HEAD|POST)" servers="http://172.16.5.22:94"
</Object>
<Object name="ECLINIC">
PathCheck fn="hardcoded_auth"
#PathCheck fn="test_fn"
#PathCheck fn="test_fn2"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" method="(GET|HEAD|POST)" servers="http://172.16.5.53:8080"
</Object>
<Object name="LOGOFF">
PathCheck fn="logoff_user"
</Object>
so as you can see I say if the URI contains /ECLINIC/ in it execute the block "ECLINIC" which invokes the function hardcoded_auth and then if it is success it redirects request to URL:http://172.16.5.53:8080
My problem is.... in the function hardcoded auth. If I use the function netbuf_getc to read from the sn->inbuf to read the parameters sent if the HTTP Method is POST the redirection takes
very long time (about 25 seconds) I don't know why? If i don't use this api and make the http method GET (so I don't use the netbuf_getc function) the request is redirected in 1 or 2 seconds.
I checked My logs and I am sure that the function netbuf_getc itself returns pretty fast and I return REQ_PROCEED or REQ_NOACTION to make the http request proceed but after this return
it takes a 25 seconds to redirect to the URL why is it taking so long.. and notice it only takes that time only if i invoke the netbuf_getc or netbuf_getbytes funciton
can any body help me?

