How to set header/cookies for Titanium Network Socket TCP? - cookies

I'm trying download a image file from remote server using Titanium.Network.Socket.TCP.
Server requires header/cookies, how to set cookies?

In HTTP requests, you can use the method setRequestHeader to include your header information.
For example:
xhr.setRequestHeader("X-Auth-Token", "foobar");
Docs: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Network.HTTPClient-method-setRequestHeader

Related

How to change soap context's mode in Gsoap when deploying a service using mod_gsoap?

So I am deploying a web service developed using gsoap using mod_gsoap. I wanted to set SOAP_IO_KEEPALIVE and SOAP_IO_CHUNK modes of the soap context object to accept chunked requests. How do I achieve this?
Or is there any other way to accept chunked requests? Right now the server responds as soon as it receives the first chunk without waiting for the rest.
The documentation says:
Warning
Do not use any of the SOAP_IO flags to initialize or set the
context, such as SOAP_IO_KEEPALIVE and SOAP_IO_CHUNK.
The Apache server controls the connection settings and HTTP payload parameters to send and receive HTTP requests. Data is received with ap_get_client_block, which de-chunks the content when chunked.

django send image filed oher rest api

I am using Django.
[My web application structure]
I have implemented the structure shown in the picture above
But I have a problem.
There is no problem with images send between clients and bridge hosts.
However, I am not sure how to send an image between the host and the bridge host.
How should I send it?
You probably want to send the image to the Host's REST API using a library such as requests.
On the Bridge Host in the view that receives the file from the client, you will need to get a handle on the file:
# Get the file sent by the Client
image_file = request.FILES.get('name_of_file')
Then you'll need to post that file to the REST API end point of the Host.
# Post the file to the Host from the Bridge Host using "requests" library
requests.post('/Host/image/endpoint/url', data={'name_of_file', image_file.read()})
You will need to pip install requests on the Bridge Host if it is not already present.
More info about making POST requests using requests: http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file

apache if header contains then pass it to another url(jboss server)

I want to check a http header in request, which is received on apache 2.2 and if it contains that header I would like to fire a new request to jboss whose ip is different from apache server's. Is this possible?
I have seen this doc
enter link description here
In the above link I can check if header exist, but how to create new request to another server with same header forwarded.
Any help is appreciated.
What you suggest would send a redirect response to the browser, and it would be the browser who would end up visiting your Jboss server.
I'm not sure if that's precisely what you want, but sounds like what you want is to get Apache to do that request to Jboss and then send the response to the browser. This would be the typical scenario with a web server (apache) and an application server (Jboss) where you normally don't access the application server directly.
What you want to make this work in apache is a reverse proxy.

Is that possible to dynamically add a web source client to Icecast?

I would like to build a web app to process an audio stream broadcasted by an Icecast server and send the processed stream back to the Icecast server.
The idea is that this stream becomes a new source client for the Icecast server.
I have two questions:
is there any web source client that allows to send a stream from a browser to an Icecast server?
is that possible to dynamically add this source client to the Icecast server?
Currently there are no Icecast web source clients.
And yes it is possible to dynamically add source clients, since having a <mount> section is generally not required, only if advanced mountpoint configuration is used. So just point the source client to an unused mountpoint location and use the general source password and the username source to identify.

How do I copy a file on a http server, from the client?

In the past I used an ftp server, connected via "ftp" from the client and "GET" to copy one file from the remote machine to the local machine.
Is it possible to do the same but with the server only running a http server?
Server: GoAhead Web Server.
Both client and http server on Windows.
The copy can be either initiated from the browser or if need a separate program can be written on the client. (i.e. - any windows api calls to copy a file from http server?)
(Also, the files may not be in the http root web directory but somewhere else on the server....can that happen?)
HTTP servers will only serve up files that are located within the site's document root. If you want to get at files that are outside the document root, you'll have to have a script serve up that file from the server (php, perl, cgi, etc...), or find some way of getting that file "inside" the document root.
To download files within the site's document root, you just hit a url pointing at that file - that's the core point of HTTP - you're just downloading content from the site.
HTTP servers will also not accept uploads without an intermediate script to handle it. If they did, you could upload any file you wanted to any server, anywhere.
What others mentioned about HTTP servers is true, but GoAhead Web Server is not a only a HTTP server. It provides many other features on top of that. And file upload seems possible, with help of a patch. More info:
https://embedthis.com/goahead/
Use WebDav for this purpose.