+
+ if(cd) {
+ /* This behavior is encouraged by the CGI specification (RFC 3875, 7.2),
+ * but not strictly required, and I get the feeling it might break some
+ * relative paths here or there, so it's not the default for now. */
+ if((sp = strrchr(file, '/')) != NULL) {
+ *sp = 0;
+ if(chdir(file)) {
+ *sp = '/';
+ } else {
+ file = sp + 1;
+ }
+ }
+ }
+