How to make this into curl request - http

Hello I want to talk to an unknown .cgi from a printer.
I don't know anything about the cgi and I can't access it.
as far as I know the request is going to printer/IDS/Fax2PC.cgi with the following
---------------EPM
Content-Disposition: form-data; name="EPM";filename=""
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<F2PC_Regi UserID="USER" UniqueID="828ba874266f83e3" RegiType="ADD"/>
</root>
---------------EPM--
OR
---------------EPM
Content-Disposition: form-data; name="EPM";filename=""
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<F2PC_Regi UserID="USER" UniqueID="828ba874266f83e3" RegiType="DELETE"/>
</root>
---------------EPM--
how can I make the same request as a curl?

Related

Keycloak authorization fails when the access_token is directly used (403 - Forbidden)

I have a docker-keycloak running on my localhost:8080 and I have a tomcat server running on localhost:8081 where a servlet is running /dummy and I get a Hello World back.
Now I've created a filter for the Keycloak and added to the war and redployed the servlet. And as expected I get a 403 - Forbidden
Type Status Report
Description The server understood the request but refuses to authorize it.
In Keycloak Admin-Console I have a Client dummy and a user demo (realm also demo).
Here is the keycloak.json in the app:
{
"realm": "demo",
"auth-server-url": "http://localhost:8080/auth",
"ssl-required": "external",
"resource": "dummy",
"public-client": true
}
So first I do:
POST http://localhost:8080/auth/realms/demo/protocol/openid-connect
/token?client_id=dummy&username=demo&password=demodemo&grant_type=password
Accept: */*
Cache-Control: no-cache
and then I receive something like this:
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJPcHNsOVltbmdEbmlCWGZheUsxNy1lbEJkZVNqTHlWdjI3QXpLMmVNYTRzIn0.eyJqdGkiOiJlYTc5ZjUzZC0zM2IzLTQ2OGYtOTkzMS03NmFjMGFiOWNmMTUiLCJleHAiOjE1MjY0NjkxMzQsIm5iZiI6MCwiaWF0IjoxNTI2NDY4ODM0LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvZGVtbyIsImF1Z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JmKGSOIYKfJK_MOO1NycSaph13QlpQ9hy1txqRUTykyNvw",
"not-before-policy": 0,
"session_state": "facd4c6b-02f3-444c-831c-d698fea379a7"
}
again this works smooth, but when I do the following request:
GET http://localhost:8081/dummy
Accept: */*
Cache-Control: no-cache
Authorization: bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJPcHNsOVltbmdEbmlCWGZheUsxNy1lbEJkZVNqTHlWdjI3QXpLMmVNYTRzIn0.eyJqdGkiOiJlYTc5ZjUzZC0zM2IzLTQ2OGYtOTkzMS03NmFjMGFiOWNmMTUiLCJleHAiOjE1MjY0NjkxMzQsIm5iZiI6MCwiaWF0IjoxNTI2NDY4ODM0LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvZGVtbyIsImF1ZCI6ImR1bW15Iiwic3ViIjoiOTUyZjAxNjYtODg4Zi00ZTE0LWFiOTYtZTRmMDcxNmViOTMxIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZHVtbXkiLCJhdXRoX3RpbWUiOjAsInNlc3Npb25fc3RhdGUiOiJmYWNkNGM2Yi0wMmYzLTQ0NGMtODMxYy1kNjk4ZmVhMzc5YTciLCJhY3IiOiIxIiwiY2xpZW50X3Nlc3Npb24iOiJiNGU0MGEyMS1lMTA1LTRmMTgtOTc2My00Mzk4YzI5NDg3MWEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiZHVtbXkvKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsib2ZmbGluZV9hY2Nlc3MiLCJ1bWFfYXV0aG9yaXphdGlvbiJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJ2aWV3LXByb2ZpbGUiXX19LCJuYW1lIjoiZGVtbyBkZW1vbnN0cmF0aW9uIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiZGVtbyIsImdpdmVuX25hbWUiOiJkZW1vIiwiZmFtaWx5X25hbWUiOiJkZW1vbnN0cmF0aW9uIiwiZW1haWwiOiJkZW1vQGRlbW8uZGUifQ.jLGZV3N40Tl8IVPy1jWiC2tNJsRZ4MQQNL2cl6qgAarzh5HDSQIlbWkcAQZ1zM2SOA3QBs1kXYEBAtPzDP1hClc8j_tAKqVBjUJTQQsb_IloYSOrAXGiubiqsjF_lcjLQXaKrYuDPDjMUGi6mgHNeWNoAePH8RPdl0G6DXhIoRvrycoj1iQ1KD07VX-5QDWaUo-T-MVRjy6EKAQsg4xSdHRXDuYTz1in4Kx7oSQMruWjwS0AbcMhFq7B-u8o_Z5KXZAhzvZ7fnUv-hU4Bn-6gg-j_Xuq1591kcB7iRoINtLMfH_2poKoyj-sbVxqc1NBG32_brgdaGk00kwB6joQsQ
I still get a 403.
What do I do wrong here?
I expect to see again the Hello World Text from the start.
Edit: add web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
>
<!-- This is only here because Maven requires it to make a war. -->
<module-name>dummy</module-name>
<servlet>
<servlet-name>dummy</servlet-name>
<servlet-class>com.dummy.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dummy</servlet-name>
<url-pattern>/dummy</url-pattern>
</servlet-mapping>
<filter>
<filter-name>Keycloak Filter</filter-name>
<filter-class>com.dummy.security.keycloak.OIDCFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Keycloak Filter</filter-name>
<url-pattern>/keycloak/*</url-pattern>
<url-pattern>/dummy/*</url-pattern>
<url-pattern>/protected/*</url-pattern>
</filter-mapping>
</web-app>
As for Keycloak Version I use 2.5.5-Final

WebDAV properties returned back in request even after setting them

I am trying to develop a simple CalDAV server for my application and in this regard I am trying to serve the initial PROPFIND request from the calendar client.
The calendar client requests for a set of properties (as shown below) to be set by the server in response to the request:
Method: PROPFIND /calendars/user/ HTTP/1.1
Request Header:
Accept-encoding gzip, deflate
Accept */*
Connection keep-alive
Prefer return=minimal
Host 192.168.0.12:8080
Brief t
User-agent Mac+OS+X/10.10.5 (14F27) CalendarAgent/316.1
Depth 0
Authorization Basic YWRtaW46cGFzc3dvcmQ=
Accept-language en-us
Content-type text/xml
Content-length 743
Request Body:
<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
<A:prop>
<B:calendar-home-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<A:current-user-principal/>
<A:displayname/>
<C:dropbox-home-URL xmlns:C="http://calendarserver.org/ns/"/>
<C:email-address-set xmlns:C="http://calendarserver.org/ns/"/>
<C:notification-URL xmlns:C="http://calendarserver.org/ns/"/>
<A:principal-collection-set/>
<A:principal-URL/>
<A:resource-id/>
<B:schedule-inbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<B:schedule-outbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<A:supported-report-set/>
</A:prop>
</A:propfind>
As a response to the above PROPFIND request I set the response as shown below:
Response Header
Accept-encoding gzip, deflate
Accept */*
Connection keep-alive
Prefer return=minimal
Host 192.168.0.12:8080
Brief t
User-agent Mac+OS+X/10.10.5 (14F27) CalendarAgent/316.1
Depth 0
Authorization Basic YWRtaW46cGFzc3dvcmQ=
Accept-language en-us
Content-type text/xml
Content-length 743
Response Body
String response = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"+
"<A:multistatus xmlns:A=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\">" +
"<A:response>" +
"<A:href>/calendars/user/</A:href>" +
"<A:propstat>" +
"<A:prop>" +
"<B:calendar-home-set xmlns:B=\"urn:ietf:params:xml:ns:caldav\"><B:href>/admin/calendar/test/</B:href></B:calendar-home-set>"+
"<B:calendar-user-address-set xmlns:B=\"urn:ietf:params:xml:ns:caldav\"/><A:href>mailto:admin#example.de</A:href></B:calendar-user-address-set>"+
"<A:current-user-principal><A:href>/principals/users/admin</A:href></A:current-user-principal>"+
"<A:displayname>Test calendar</A:displayname>"+
"<A:principal-collection-set><A:href>/principals/users/</A:href><A:href>/principals/groups/</A:href></A:principal-collection-set>"+
"<A:principal-URL><A:href>http://192.168.0.12/principals/users/admin/</A:href></A:principal-URL>"+
"<A:supported-report-set xmlns:n2=\"urn:inverse:params:xml:ns:inverse-dav\" xmlns:n3=\"urn:ietf:params:xml:ns:carddav\" xmlns:A=\"DAV:\" xmlns:n1=\"urn:ietf:params:xml:ns:caldav\">"+
"<A:supported-report><A:report><n1:calendar-query/></A:report></A:supported-report>"+
"<A:supported-report><A:report><n1:calendar-multiget/></A:report></A:supported-report>"+
"<A:supported-report><A:report><n2:acl-query/></A:report></A:supported-report>"+
"<A:supported-report><A:report><A:sync-collection/></A:report></A:supported-report>"+
"<A:supported-report><A:report><A:expand-property/></A:report></A:supported-report>"+
"<A:supported-report><A:report><n3:addressbook-query/></A:report></A:supported-report>"+
"<A:supported-report><A:report><n1:free-busy-query/></A:report></A:supported-report>"+
"</A:supported-report-set>"+
"<B:schedule-inbox-URL xmlns='urn:ietf:params:xml:ns:caldav'><href xmlns='DAV:'>/calendars/__uids__/admin/inbox/</href></B:schedule-inbox-URL>"+
"<B:schedule-outbox-URL xmlns='urn:ietf:params:xml:ns:caldav'><href xmlns='DAV:'>/calendars/__uids__/admin/outbox/</href></B:schedule-outbox-URL>"+
"<C:dropbox-home-URL xmlns='http://calendarserver.org/ns/'><href xmlns='DAV:'>/calendars/__uids__/admin/dropbox/</href></C:ropbox-home-URL>"+
"</A:prop>" +
"<A:status>HTTP/1.1 200 OK</A:status>" +
"</A:propstat>" +
"</A:response>" +
"</A:multistatus>";
After sending the response to client, the client again sends back the same properties (not all - as shown below).
<?xml version="1.0" encoding="UTF-8"?>
<A:propfind xmlns:A="DAV:">
<A:prop>
<A:current-user-principal/>
<A:principal-collection-set/>
</A:prop>
</A:propfind>
So can anyone let me know where am I going wrong in setting these properties ?
As Evert mentioned in the comment section, the client is bit chatty. After several observations even I found the same.

HTTP POST request with file and string parameter to Node.js

I have written a POST route in Express.js: /api/file/upload. This route needs two parameters to work - a "file" parameter with the posted file and an "apiKey" parameter, which is a string. To test it, I am trying to create a successful request in Fiddler2 with the following data:
Headers:
Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Host: localhost:8000
Content-Length: 178037
Request Body:
---------------------------acebdf13572468
Content-Disposition: form-data; name="file"; filename="4Byl64P (1).jpg"
Content-Type: image/jpeg
<#INCLUDE *C:\Users\patrick\Pictures\4Byl64P (1).jpg*#>
---------------------------acebdf13572468--
---------------------------acebdf13572468
Content-Disposition: form-data; name="apiKey"
Content-Type: application/json
{
"apiKey": "GKBG-QoNs-f74E-Z8Qn-zozm"
}
---------------------------acebdf13572468--
But when I try to log the parameters in Node.js, I get an empty object for request.body and undefined for request.files.
How do I successfully POST form data to Node.js using Fiddler2?
Your body is malformed (premature ending boundary). It should probably look more like this:
---------------------------acebdf13572468
Content-Disposition: form-data; name="apiKey"
Content-Type: application/json
{
"apiKey": "GKBG-QoNs-f74E-Z8Qn-zozm"
}
---------------------------acebdf13572468
Content-Disposition: form-data; name="file"; filename="4Byl64P (1).jpg"
Content-Type: image/jpeg
<#INCLUDE *C:\Users\patrick\Pictures\4Byl64P (1).jpg*#>
---------------------------acebdf13572468--

ASMX not throwing SOAP faults

My ASP.NET 3.5 web service (asmx) is not throwing exceptions as SOAP faults. Everything I've seen says this is the default behavior but mine is sending all exception information as text/plain. This is a new web application project with one service added. No other changes from out of the box behavior. How do I get SOAP faults?
Code:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
int test1 = 0;
int test2 = 5 / test1;
return "Hello World";
}
}
Result:
HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 25 Oct 2011 21:39:23 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 201
Connection: Close
System.DivideByZeroException: Attempted to divide by zero.
at WebApplication.WebService.HelloWorld() in C:\....cs:line 23
ASMX web services will only respond with SOAP if the request was SOAP. The testing page generated for you by the service doesn't include the SOAP request envelope:
POST http://server/service.asmx/HelloWorld HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Host: server
A proper SOAP request looks like this:
POST http://server/service.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://server/HelloWorld"
Host: server
Content-Length: 283
Expect: 100-continue
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<HelloWorld xmlns="http://server/" />
</soap:Body>
</soap:Envelope>
Notice the SOAPAction header field and the SOAP envelope content. If the request is a valid SOAP request the service will respond with a SOAP response. For the initial example, the following SOAP fault is the response:
HTTP/1.1 500 Internal Server Error
Date: Sat, 05 Nov 2011 16:55:17 GMT
Content-Type: text/xml; charset=utf-8
Content-Length: 695
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>
System.Web.Services.Protocols.SoapException: Server was unable to process request. --- > System.DivideByZeroException: Attempted to divide by zero.
at Service.HelloWorld() in C:\Test\Service.asmx.cs:line 35
--- End of inner exception stack trace ---
</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>

ASP.NET WebService, I want to add some custom HTTP headers onto a ASP.Net web service

I want to add some custom HTTP headers onto a ASP.Net web service to allow cross site access.
the result I need is something like this.
i.e,
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: X-Requested-With
Access-Control-Max-Age: 86400
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope >
<soap:Body>
.....
</soap:Body>
</soap:Envelope>
I tried this but it doesn't work
<WebMethod()> _
Public Function SomeMethod(blabla...) As Something
...
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*")
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "X-Requested-With")
HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "86400")
...
End Function
I'm using Don.Net 2.0
any idea?
thanks in advance.

Resources