---------------------------------------------------------------- BEFORE YOU POST, search the faq at <http://java.apache.org/faq/> WHEN YOU POST, include all relevant version numbers, log files, and configuration files. Don't make us guess your problem!!! ---------------------------------------------------------------- I sent this message a week or so ago to the users mail list, but didn't get any responses, so I am trying again by sending it to the dev mail list. I am having problems getting my servlets to correctly handle ETags when running with JServ. Environment: JServ 1.1, Apache 1.3.9, Windows NT 4.0, IBM 1.1.8 JVM I have implemented the logic to handle the ETags (and the If-Match, If-None-Match, etc. headers) in my servlet. The problem is that even though in my servlet, I have handled the logic and verified that the If-Match header contains the proper ETag for the resource for which I am returning a 200 response code, Apache is ignoring my response code and instead reevaluating the If-Match header and returning a 412 error to the client. In looking at the code, I have found the following: The function ajpv12_pass_headers() in jserv_ajpv12.c does the work of getting the headers from JServ and giving them to Apache. ajpv12_pass_headers() calls ap_scan_script_header_err_buff() which in turn calls ap_scan_script_header_err_core() ap_scan_script_header_err_core() gets the headers from JServ and places them in a temp variable. It then calls ap_meets_conditions() and then finally sets the headers in err_headers_out. It is ap_meets_conditions() that is doing the work in Apache to check the If-Match header (and all ETag related headers). ap_meets_conditions() is first getting the responses ETag header from headers_out to compare to the If-Match header of the request. And here lies the problem. JServ/mod_jserv has not set the ETag header in headers_out (even though ETag is one of the headers I have set in my Servlet response), so Apache is comparing a legal value in the If-Match header to null and giving back a 412 response. I believe there is either a bug in JServ/mod_jserv that it is not correctly handling the ETag response header as Apache expects, or there is a bug in Apache in how it handles ETags for modules like JServ. (or maybe a little of both). In looking at the logic in the Apache function ap_meets_conditions() it is clear that Apache expects that the correct value for the ETag header for the resource will be set in headers_out. JServ/mod_jserv never sets any headers in headers_out. JServ/mod_jserv indirectly (through the call to ap_scan_script_header_err_buff) sets the headers in err_headers_out. So even though I am setting the ETag header in my servlet, it is not getting to Apache in the place that Apache is looking for it. To work around the problem I have modified Apache's util_script.c file and added the following three lines in the ap_scan_script_header_err_core() function at approximately line 519 (code is added before the call to ap_meets_conditions()): if (ap_table_get(merge, "ETag")) { ap_table_set(r->headers_out, "ETag", ap_table_get(merge, "ETag")); } I am taking the value from the ETag header that was passed if it exists and setting the ETag header in headers_out to this value. With this everything seems fine. Before I go to the Apache developers suggesting that this is the fix to get JServ to work with ETags, I wanted to run this by the JServ developers, to verify that what I have done is first correct, and then that it is the best solution to my problem. thanks, --Barry -- -------------------------------------------------------------- Please read the FAQ! <http://java.apache.org/faq/> To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED] Archives and Other: <http://java.apache.org/main/mail.html> Problems?: [EMAIL PROTECTED]