http server with basic autentification in qt - qt

I'm writing application which should have build in simple http server for remote control access. I'm using Qt and want to provide to user a way to autentificate.
I've found an http server realisation(by Stefan Frings). Can some one help with solving this problem?

Found the solution myself. It is rather easy by the way....
We just need to add WWW-Authenticate into header and on server side check creditinals.

Related

How do I get http request header fields server side in a Meteor.js app?

How do I get the http request header fields server side in a Meteor.js app?
For example in PHP one could use one of the following to determine what host or domain the request was on.
$_SERVER['HTTP_HOST'] or $_SERVER['SERVER_NAME']
I know on the client side I can get that from
document.domain
and then I could pass it to the server.
But is there an easier way to get at least the HOST (something.domain.com) that the client made the request on?
After Meteor 0.7 you have to call on the server side
this.connection.httpHeaders
source http://www.meteorpedia.com/read/HTTP_Headers
Your timing is great, I just wrote the following package a few days ago.
https://atmospherejs.com/gadicohen/headers
Use like this:
js
var host = headers.get('host');
Though if you're only after the host, and you can get it from one of the other solutions provided here, they're preferable. The headers unfortunately have to make a round trip to the server and back, and the package is intended to get headers that aren't accessible any other way.
Meteor.absoluteUrl();
From the docs:
http://docs.meteor.com/#meteor_absoluteurl

Intercept http request for the files on file server

http://myfileserver/images/car/chevrolet.gif
I have this file server holding the files such as images, doc files etc. Now i want to intercept the http request and based on the file extension i want perform some action such as redirection to some other webpage.
What is the best and the easier way to accomplish this thing? I am using asp.net framework for my applications.
Pls suggest the approach.
Thx
If you are looking to intercept the request for specific file types, then go with an Http Handler. Here is the MSDN link explaining their usage - Http Handlers
In the WCF world if you're looking to handle an HTTP request with a different option based on the requested filetype, you may want to look into adding an IDispatchOperationSelector, which allows the service to route the code through a different operation. The default HTTP implementation is the WebHTTPDispatchOperationSelector, which is explained pretty well here and here.
If you want to remain in the Asp.Net world, I'd recomend going with custom message handlers. Here's an article by Mike Wasson explaining how these work & where they fall in the Asp stack.

OSGi HTTP Client Post Method

I have just started to learn OSGi. Recenly got stuck with an issue. How can I post data
to a HTTP server from an OSGi bundle without using external bundles/framework?
I will like to see code sample of a simple OSGI bundle which acts as a HTTP
client and can send a string to a HTTP server (tornado, in my case).
I have searched around a lot. But I got no direct solutions. There are restlets, Felix and all type of solutions. The only thing I want is to send data from an OSGi bundle to a HTTP server without using any external frameworks. Is it possible?
Please help me out.
Thanks in advance.
Posting data to an HTTP server has nothing to do with OSGi at all, plain Java is all you need.
If you want to go really barebones, you can use an HttpURLConnection to post your data. You can also choose a little more comfort, and use the Apache HttpComponents Client.

find which server in a web farm the web method got executed?

This question is a consequence of the following question: determining which server (in a web farm) the asp.net ajax request came from?
The problem is that we commonly use automatically generated proxy classes to communicate with the web method (which may be part of asmx/wcf service). When we receive the response from the web services server, how do we know which server it got processed from?
We receive the response from the server side code which is executing (mostly). When its a script service (which can be called via javascript) its another case altogether.
How can we read the response headers once the web service returns?
Am I constrained to build my own proxy classes to solve this problem?
One way. Its not the best way but it will do until something new comes about. If you have a tool like fiddler/burp, you can inspect the response headers. So we must configure the IIS to set the response headers appropriately.
By default they are configured to output something like X-ASP.NET...a good idea would be to add the server name to that...

Replacing http responses from a specific URL in Windows

I have some software which makes a request to a specific URL in internet and I want it to receive my custom response. Is there any software tool for that on Windows? Also it would be nice if I could map a regexp instead of specific URL
Found the solution myself:
Set the domain of the URL to point to 127.0.0.1 in windows hosts file
Install nginx and set it up to show your file for the request response to which you're willing to modify and proxy all other requests to the original server
You could consider writing a test and mocking out the http response with your custom response.
I could give an example using C# and rhino mocks but it's not clear which platform you are working with.
You can:
Try to enject your dll into the process and replace functions like (HttpSendRequest, HttpQueryInfo,...) with your oun versions.
Try to use something like WinPCap (http://www.winpcap.org/).
Fiddler (www.fiddler2.com) has an AutoResponder feature which does exactly that.

Resources