About This File
Purpose (from Microsoft's website)
The HTTP Server API enables applications to communicate over HTTP without using Microsoft Internet Information Server (IIS). Applications can register to receive HTTP requests for particular URLs, receive HTTP requests, and send HTTP responses. The HTTP Server API includes SSL support so that applications can exchange data over secure HTTP connections without IIS.
There have been several times in the past that I wanted to either retrieve information from one of my PCs or execute commands on one of my PCs, whether it was from across the world or sitting on my couch. Since AutoIt is one of my favorite tools for automating just about anything on my PC, I looked for ways to make to make it happen. Setting up a full blown IIS server seemed like overkill so I looked for lighter weight solutions. I though about creating my own AutoIt UDP or TCP server but that just wasn't robust enough, Then I found Microsoft's HTTP Server API and it looked very promising. After doing a little research into the APIs, I found that it was flexible & robust enough to handle just about any of the tasks that I required now and in the future. So a while back I decided to wrap the API functionality that I needed into an AutoIt UDF file to allow me to easily create the functionality I needed at the time. It has come in very handy over the years. Of course it wasn't all wrapped up with a nice little bow like it is now. That only happened when I decided to share it with anyone else who could use it or learn from it.
The example file that I included is a very granular example of the steps required to get a lightweight HTTP Server up and listening for GET requests. The UDF is a wrapper for the Microsoft APIs. That means to do anything over and above what I show in the example, one would probably have to have at least a general knowledge of APIs or the ability to figure out which APIs/functions to use, what structures and data is needed to be passed to them, and in what order. However, the UDF gives a very solid foundation on which to build upon. Of course, if anyone has questions about the UDF or how to implement any particular functionality, I would probably help to the extent that I could or point you in the right direction so that you can figure out how to implement your own solution.
The APIs included in the UDF are the ones that I needed in the past to do what I needed to do. If any additional APIs need to be added to the UDF file, please make those suggestions in the related forum topic.
Being that this is basically an AutoIt wrapper for the Microsoft API functions, there's no need to create AutoIt-specific documentation. All of the UDF functions, structures, constants, and enumerations are named after their Microsoft API counterparts. Therefore, you can refer to Microsoft's extensive documentation of their HTTP Server API. As stated earlier, if there is one or more APIs that you find yourself needing for your particular solution, please suggest it in the related Example Scripts forum topic.
What's New in Version v1.1.1
Optimized the fix made by @Danyfirex so that it works for all of the union'd DATA_CHUNK structs.
- Optimized the fix made by @Danyfirex so that it works for all of the union'd DATA_CHUNK structs.
An issue was resolved that was causing HTTP responses to fail when running in 32-bit mode. The issue was found and fixed by @Danyfirex.
- An issue was resolved that was causing HTTP responses to fail when running in 32-bit mode. The issue was found and fixed by @Danyfirex.
Currently, the HTTP Server API example only works correctly when run as x64 on a x64 OS.
There is an issue when running as x86 on a x64 OS (WOW64). Since I do not have a x86 OS machine to test on, I'm not sure if it will run correctly as x86 on a x86 OS.
- In this version, I added "#AutoIt3Wrapper_UseX64=Y" directive to the example file until I can figure out the issue with running as x86 on x64 PC.
I also changed all of the API DllCalls in the UDF from cdecl calls stdcall calls.
- Currently, the HTTP Server API example only works correctly when run as x64 on a x64 OS.
- Initial Release