Page 1 of 1

Add Header on HTTP Response Text

Posted: 14 Jan 2014 11:59
by fede91it
I've created a flow that allows me to start the AirDroid server through an HTTP Request like 192.168.0.xx/airdroid, and than responds to the client with a redirect instruction pointing to the effective AirDroid server, 192.168.0.XX:8888.

Actually I have to use an html meta refresh tag but it isn't a good solution.
Can you add the possibility to set customized HTTP headers?

Re: Add Header on HTTP Response Text

Posted: 14 Jan 2014 18:12
by Martin
I can add this to the todo-list.
What kind of headers would you like to set in the HTTP request?

Re: Add Header on HTTP Response Text

Posted: 14 Jan 2014 20:00
by fede91it
Can you design this new feature in a way that allows to add infinite and customized headers?
I imagine that with a textarea space when I can write some things like:
Header-1: value
Header-2: value
Header-3: etc...
So if anyone in the future needs some special header can set it. It's a bad idea?

Re: Add Header on HTTP Response Text

Posted: 14 Jan 2014 21:02
by Martin
Sure, it's a good idea to allow arbitrary headers. For me it's also interesting to know what you specifically want to do with the new feature so I don't miss anything important. Do you want to add a header with a text value or a header that needs a special encoding like Base64?
Perhaps I've misread your initial post, do you want to set the headers in an action HTTP Request or in a HTTP response written with action Write HTTP Response Text/File?

Re: Add Header on HTTP Response Text

Posted: 16 Jan 2014 08:17
by fede91it
I haven't the enecessity of use a base64 value. In the Write HTTP Response Text/File, but howeaver if isn't too hard to implement you can add this feature also in all HTTP like requests/reponses.

Re: Add Header on HTTP Response Text

Posted: 17 Jan 2014 12:25
by Martin
You can use function setHTTPResponseHeader in a script to add a custom header to a response before the actual response is sent with action Write HTTP Response Text/File:
-trigger HTTP Request: /automagic/*, port 8080
-action Script: setHTTPResponseHeader("headername", "value1")
-action Write HTTP Response Text: <html>...

I've added it to the todo-list to also add custom headers to request.

Re: Add Header on HTTP Response Text

Posted: 17 Jan 2014 18:27
by fede91it
You are the best, thank you!