http methods not recognized

232 views
Skip to first unread message

mouhsine...@gmail.com

unread,
Oct 30, 2014, 1:55:11 PM10/30/14
to phpde...@googlegroups.com
hi i'm building a web app using angular js and php ,and when i send a [ patch ] http request ,i get the folliwng error

Error 500: Server Error
Bad request: [PATCH]

Czarek Tomczak

unread,
Oct 30, 2014, 2:11:45 PM10/30/14
to phpde...@googlegroups.com
PATCH method is not supported by Mongoose web server. Supported http methods are:

static int is_valid_http_method(const char *method) {
  return !strcmp(method, "GET") || !strcmp(method, "POST") ||
    !strcmp(method, "HEAD") || !strcmp(method, "CONNECT") ||
    !strcmp(method, "PUT") || !strcmp(method, "DELETE") ||
    !strcmp(method, "OPTIONS") || !strcmp(method, "PROPFIND")
    || !strcmp(method, "MKCOL")
          ;
}


--
You received this message because you are subscribed to the Google Groups "PHP Desktop" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phpdesktop+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phpdesktop.
For more options, visit https://groups.google.com/d/optout.

mouhsine...@gmail.com

unread,
Oct 31, 2014, 4:04:01 AM10/31/14
to phpde...@googlegroups.com, mouhsine...@gmail.com
i've switched to put method ,
and also i'm getting Response Error 401 Unauthorized when using PUT or DELETE

Czarek Tomczak

unread,
Oct 31, 2014, 4:28:06 AM10/31/14
to phpde...@googlegroups.com
Mongoose requires setting PUT_DELETE_PASSWORDS_FILE option (.htpasswd file with username/password), and later when performing PUT/DELETE request these credentials must be included in headers. If you can provide me with a php or js example of making PUT/DELETE request, I will put it to www directory as an example and create an Issue in the tracker to fix this - a new option in settings.json for authorization with a default value of "/.htpasswd".

On Fri, Oct 31, 2014 at 9:04 AM, <mouhsine...@gmail.com> wrote:
i've switched to put method ,
and also i'm getting Response Error 401 Unauthorized when using PUT or DELETE

mouhsine...@gmail.com

unread,
Oct 31, 2014, 4:37:27 AM10/31/14
to phpde...@googlegroups.com
i'm using angularjs to make put and delete requests ,for authentification i'm using a token base authentification here's an example of a delete request :

delete : function(id) {
return $http.delete('/hearings/' + id);
}

mouhsine...@gmail.com

unread,
Oct 31, 2014, 5:18:08 AM10/31/14
to phpde...@googlegroups.com
On Friday, October 31, 2014 8:28:06 AM UTC, Czarek Tomczak wrote:
there's not much of a documentation on this ,how the .htpasswd should look like ,how the username and password should be presented in the headers i'm using the following with no success :

i ve created a pdpasswd with the following

mouhsinelonly:$apr1$AbwHuLtb$b7tv5ulJfvkx4VZLKdVzD/

in the headers i have

//// the encrypted string contain the password and username
$http.defaults.headers.common.Authorization = 'Basic bW91aHNpbmVsb25seToxMjM0NTY=';

in settings.json

"PUT_DELETE_PASSWORDS_FILE":".pdpasswd"

Czarek Tomczak

unread,
Oct 31, 2014, 5:23:13 AM10/31/14
to phpde...@googlegroups.com

mouhsine...@gmail.com

unread,
Oct 31, 2014, 5:27:13 AM10/31/14
to phpde...@googlegroups.com
thanx ,i really liked phpedesktop and hoped to publish my project with it ,but i guess i have to come back when this gets implemented ,put and delete methods are essential for a web app :)

vilass...@gmail.com

unread,
May 13, 2015, 11:21:45 AM5/13/15
to phpde...@googlegroups.com
Is this issue fixed? I'm trying to use PUT/Delete method with angular to modify data but still I'm facing unauthorized access issue.
Please give me solution.
Thanks.

Czarek Tomczak

unread,
May 13, 2015, 12:51:31 PM5/13/15
to phpde...@googlegroups.com
Issue 140 is not yet fixed.

Message has been deleted

lucas...@gmail.com

unread,
Dec 13, 2016, 3:51:46 PM12/13/16
to PHP Desktop
working: replacing put and delete with OPTION and CONNECT, is not REST, but it is working :D

lucas...@gmail.com

unread,
Dec 14, 2016, 7:17:22 AM12/14/16
to PHP Desktop
Sorry, this method is not working for all. to user PUT and DELETE while the issue 140 is not fixed try the following:

in ajax method:

$.ajax({.....
headers:{'X-HTTP-Method-Override': 'PUT'},
.....});

in PHP:

$_SERVER["REQUEST_METHOD"] =(isset($_SERVER["HTTP_X_HTTP_METHOD_OVERRIDE"])?$_SERVER["HTTP_X_HTTP_METHOD_OVERRIDE"]:$_SERVER["REQUEST_METHOD"]);

anna.da...@gmail.com

unread,
Apr 22, 2019, 1:21:59 PM4/22/19
to PHP Desktop
Hi,
but this issue i solved with the .htpasswd ?
I try to set it on the settings.json file but nothing happend. Could you give me an example?

Czarek Tomczak

unread,
Apr 22, 2019, 1:42:26 PM4/22/19
to PHP Desktop
Such feature is not implemented, the issue is still open.

ndoh noela

unread,
May 23, 2019, 7:57:45 AM5/23/19
to PHP Desktop
Found a workaround solution. Used a get request which maps to a function in the controller and put the identical code as the destroy function. Not the best solution but hopes it helps someone.

Diasso Konaté

unread,
Apr 15, 2022, 10:01:24 PMApr 15
to PHP Desktop
Hi everyone,
Is this issue resolved? The delete feature not work at all!!!

I have this popup if I want make ajx call for deleting.Capture d’écran 2022-04-16 015923.png

Reply all
Reply to author
Forward
0 new messages