Apache WebDAV to Accept POST as a PUT on New Resource - rest

I have a service that is POSTing to an Apache WebDAV endpoint but POST is not a standard implemented method and on WebDAV.
The end goal is to have files uploaded via a POST to create/overwrite a resource the exact same way a PUT method currently works; as when the service does a PUT, the file is successfully created, but on POST, it only works if a file already exists.
E.g:
Successful PUT on new resource
➜ ~ curl -X PUT -k -F 'data=#test_file_upload.txt https://endpoint.tld/put_test.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>201 Created</title>
</head><body>
<h1>Created</h1>
<p>Resource /put_test.txt has been created.</p>
</body></html>
Unsuccessful POST on new resource
➜ ~ curl -X POST -k -F 'data=#test_file_upload.txt' https://endpoint.tld/post_test.txt
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /post_test.txt was not found on this server.</p>
</body></html>
I have tried Apache Rewrite but cannot change the method.
I am currently attempting to implement a Python3 Flask script with WSGI and a proxy request on POST; but this is becoming incredibly cumbersome and complicated.
Would using mod_perl allow me to script something without extending to a proxied request?
How can I leverage the lowest friction solution to have this working?

Related

Creating a Jenkins job in REST API

Im trying to create a Jenkins job from the terminal
I downloaded the config file of another project without issues
curl -X GET --user <username>:<api-token>/ http://<jenkins-server-address>:<port>/job/<job-name>/config.xml -o mylocalconfig.xml
the to create the job
curl -s -X POST --user <username>:<api-token> 'http://<jenkins-server-address>:<port>/job/createItem?name=<job-name>' --data-binary #mylocalconfig.xml -H "Content-Type:text/xml"
But I'm getting a 404
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/job/watchlist-app/job/createItem</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>Stapler</td></tr>
</table>
<hr/>Powered by Jetty:// 10.0.11<hr/>
I rember to do in this way a few months ago without issues I don't what's wrong do I missing something?
create a jenkins job from the cli interacting with the jenkins rest api

Cannot save template constants in typo3

I updated the constants of my template in the web editor of typo3. Each time I click on Save or Close+Save I get a pop-up from my browser to download a file. The content is like this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>503 Service Unavailable</title>
</head><body>
<h1>Service Unavailable</h1>
<p>The server is temporarily unable to service your
request due to maintenance downtime or capacity
problems. Please try again later.</p>
</body></html>
The minimal example to get this is:
page.theme {
socialmedia.channels {
facebook.url = https://www.facebook.com/typo3/
}
}
It seams that Typo3 has a problem with the dots in the url. If I remove all of them or escape with a backslash "\" everything works. (But the backslash remains in the url and therefore produce invalid urls)
Some months before everything works fine. Some other templates in the same installation have also urls in their configuration and they are working (the page is rendered normaly). If I try to save them noe without any changes I get the same error.
That is the system I use:
Typo3-Version: 9.5.20
Webserver: Apache/2.4.43 (Unix)
PHP-Version: 7.3.21
Database: MySQL 5.6.42
Applicationcontext: Production
OS: SunOS SunOS localhost 5.10 Generic_150401-49 i86pc
Bootstrap Package: 11.0.2

Routing to a URL behaves differently in config

I am attempting to get familiar with spring-cloud-gateway and I am having a problem configuring routes in YAML. I am attempting to do a simple redirect based on path to httpbin.org. This works fine when I do this in code but when I am attempting this in YAML config I get a 404.
YAML:
- id: demo
uri: http://httpbin.org
predicates:
- Path=/demo
When I attempt this route, it looks like the route is getting matched- I dont see a 404 for the route itself. What I get in the response is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try
again.</p>
What am I doing wrong here?

RestEASY + Jboss 7.x - can you default to first #Path when Accepts doesn't match #Produces value?

I have the following web service in RestEASY 3.6.2 on JBoss 7.1.0.
#GET
#Path("/getstuff")
#Produces(MediaType.APPLICATION_JSON + "," + MediaType.APPLICATION_XML)
public Response getStuff() {
I send a request with the following: Accept = application/json, text/javascript, */*; q=0.01
http://localhost:8080/myapp/getstuff
returns:
<html>
<head>
<title>Error</title>
</head>
<body>Internal Server Error</body>
</html>
When I specify Accept = application/json it returns the correct response.
Is there some "default fallback" I can use to make Resteasy use the first matching Path instead of failing?
Hello,
Accept header is used by HTTP clients specify for the server what content types will be accepted. The server will then send back a response, which will include a Content-Type header specifying to the client the kind of content actually is.
This is relevant because the requests might be POST or PUT requests.
This would explain the issue, therefore, cause the content type is conflicting with the Json.

.NET AdaptivePayment SDK: PaymentDetails() is throwing a ConnectionException (404)

I am calling the AdaptivePaymentService.PaymentDetails() to get the payment details for a payment, and it is throwing a ConnectionException indicating 404. In order to debug the issue, I downloaded the source for the AdaptivePayment SDK as well as the Core SDK and stepped through the code, specifically, right where the HttpRequest is executed in Paypal.HttpConnection.Execute().
It appears as if all configuration variables are being read from the web.config:
The address in the underlying httpRequest looks correct:
The payload looks correct:
However, a WebException is thrown with the following response:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /cgi-bin/ppapi was not found on this server.</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache Server at api.sandbox.paypal.com Port 443</address>
</body></html>
Any help would be greatly appreciated.
Since you have configured both ClientId/Secret and 3-token credentials (API username, password, signature) in your configuration, the endpoint has been detected incorrectly, giving the REST API higher preference. Please remove the client id / secret configuration and you should see the endpoint set correctly to https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails