Print

Print


Hi,

Could you please elaborate on the instances where GFAL2 misinterprets the response codes?

I've been looking through the davix library code that GFAL2 uses for its webdav support and it looks to me like it has the 405/409 special cases for mkdir(mkcol) the same way around as the webdav RFC (with 405 for already exists):
https://github.com/cern-fts/davix/blob/master/src/request/httprequest.cpp#L400-L403

Is the problem that patching the `mapXrdErrorToHttpStatus` function would cause issues for other methods? If that's the case, would it be possible to just patch the mkcol case return code? e.g. something like:
```
--- a/src/XrdHttp/XrdHttpReq.cc
+++ b/src/XrdHttp/XrdHttpReq.cc
@@ -2686,8 +2686,12 @@ int XrdHttpReq::PostProcessHTTPReq(bool final_) {
     {
 
       if (xrdresp != kXR_ok) {
-        prot->SendSimpleResp(httpStatusCode, NULL, NULL,
-                             httpStatusText.c_str(), httpStatusText.length(), false);
+        if (xrderrcode == kXR_ItExists) {
+          prot->SendSimpleResp(405, NULL, NULL, (char *) "Method is not allowed", 0, false);
+        } else {
+          prot->SendSimpleResp(httpStatusCode, NULL, NULL,
+                               httpStatusText.c_str(), httpStatusText.length(), false);
+        }
         return -1;
       }
```

I've tried running a standalone xrootd-5.4.2 instance with the patch above and doing an mkdir using the current EPEL7 version of gfal2 (gfal2-2.20.5-1.el7.x86_64) and it seems to map it to the correct "file exists" response:
```
$ gfal-mkdir http://localhost:1094/opt/xrootd/data/test
gfal-mkdir error: 17 (File exists) - HTTP 405 : Method Not Allowed, File Exist  with url http://localhost:1094/opt/xrootd/data/test
```

Regards,
Simon


-- 
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/issues/1663#issuecomment-1084535830
You are receiving this because you are subscribed to this thread.

Message ID: <[log in to unmask]>

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1