Our company invites you to take the first step with us towards a happy, fulfilling life. The drugs we offer will help you with this:
- -generics: Levitra and Cialis, as well as Poppers will make the sexual side of your life bright and rich
- -synthetic growth hormones: Dinatrope, Ansomon and Getropin will add strength, energy to athletes and solve the problems of excess weight
- -preparations and dietary supplements: Moriamin Forte, Tribulus terrestris, Ecdysterone and Guarana will return lost energy to you, increase the body's endurance, rejuvenate the skin, and restore the functioning of many internal organs.
Why do we offer to buy from us? There are several reasons:
- -our company is the first and so far the only official representative in Russia for the sale of generics, sildenafil, and a distributor of other drugs
- -the quality of our products is guaranteed by official supplies of drugs
- - for buyers who are embarrassed by the thought that the word “Viagra” will need to be said out loud in a pharmacy, anonymous ordering of goods on the website is an excellent opportunity to purchase the necessary drug
- -convenient and fast courier delivery in Moscow and St. Petersburg, mailing of drugs to other regions is possible
It is profitable to buy from us
- !we are constantly running new promotions that allow you to buy generics of Levitra, Cialis and Sildenafil and others at very competitive prices
- !The company gives each new customer a loyalty card to purchase medications with a 10% discount
- !when you order goods worth more than 5 thousand rubles, you will receive a gift - free delivery
- !for wholesale buyers, purchases at special prices are possible for relatively small quantities of goods with the issuance of a sales receipt
- !participation in the affiliate program gives you another significant discount on the cost of goods in the amount of 40%
Our employees make every effort to make the purchase of drugs as convenient as possible for the buyer.
Delivery of goods is carried out without weekends and holidays up to 24 hours. For VIP clients: Cialis and other potency drugs are also delivered around the clock
Payments are accepted through electronic payment systems Yandex Money, Web Money and from Master Card or Visa bank cards. You can contact us for a free consultation at any time. »
by multi-line phones:
- 8 (800)200-86-85 (free call within Russia),
- +7 (800)200-86-85 (St. Petersburg)
- +7 (800)200-86-85 (Moscow)
India cheap cialis inurl read cgi board
If you carefully read the description of Cialis, it becomes clear that this is not an aphrodisiac, it is not a drug for increasing libido. Dosage Middle-aged men are recommended to take a dose of 20 mg at least 16 minutes before expected sexual activity, regardless of meals. No hormones, no stimulants. But even if you have such diseases, you can take Cialis. Patients can attempt sexual intercourse at any time within 36 hours after dosing in order to establish the optimal response time to tadalfil. On the reverse side there is information about the expiration date and composition of the drug. If you need generic Cialis, you can always order it at our pharmacy. What are the contraindications for Cialis? Untimely treatment of priapism leads to damage to the tissue of the penis, which can result in long-term loss of potency. Contraindications Concomitant use of drugs containing any organic nitrates; children and adolescents up to 18 years of age; hypersensitivity to tadalafil. Pharmacokinetics: After oral administration, tadalafil is rapidly absorbed. As a result, the medication is effective for 36 hours! In our pharmacy, Cialis, the price of which is very affordable in Ukraine, can be purchased at any time of the day. Manufacturer: India Gift: 5 tabs Generic Cialis for orders over 20 tabs Free pickup m.
The article has been circulating on the Internet for quite some time, but, as the author, I think I have the right to repost it here. Much (if not all) written here is outdated and may seem useless at first glance, but having gone this route, 6 years later I can say that it was not superfluous. So.
In this article I want to talk about the CGI interface in general, its implementation for Windows and the use of assembly language in particular when writing CGI programs. The scope of this article does not include a full description of CGI, since there is simply a sea of material on this issue on the Internet and I simply don’t see the point in retelling it all here.
CGI theory
CGI – (Common Gateway Interface)– Common Gateway Interface. As you might guess, this interface serves as a gateway between the server (here I mean the server program) and some external program written for the OS on which this very server is running. Thus, CGI is responsible for exactly how data will be transferred from the server program to the CGI program and back. The interface does not impose any restrictions on what the CGI program should be written in; it can be either a regular executable file or any other file - the main thing is that the server can run it (in the Windows environment, for example, it can be a file with the extension tied to any program).From the moment you called (for example, clicked a form button to which a CGI program call is attached) the CGI program until you receive the result in your browser window, the following happens:
- A web client (for example a browser) creates a connection to the server specified in the URL;
- The web client sends a request to the server, this request is usually made using two methods GET or POST;
- Data from the client request (for example, form field values) are transferred by the server, using the CGI interface, to the CGI program specified in the URL;
- The CGI program processes the client data received from the server and, based on this processing, generates a response to the client, which it transmits via the same CGI interface to the server, and it, in turn, transmits it directly to the client;
- The server terminates the connection with the client.
The standard CGI specification assumes that the server can communicate with the program in the following ways:
- Environment variables – they can be set by the server when the program starts;
- Standard input stream (STDIN) – with its help the server can transfer data to the program;
- Standard output stream (STDOUT) – the program can write its output into it, which is transmitted to the server;
- Command line – in it the server can pass some parameters to the program.
Standard input/output streams are very convenient and widely used on UNIX systems, which cannot be said about Windows, so there is a CGI specification developed specifically for Windows systems, called “Windows CGI”. But, of course, standard input/output streams can also be used in windows CGI programming. Here I will not touch on the “Windows CGI” standard, and there are at least two reasons for this - the first, and most important, is that at the moment not all http servers for Windows support this specification (in particular, my favorite Apache 1.3.19) . You can see the second reason by typing “Windows CGI” in any search engine. I will note only general details regarding this interface - all data from the server to the client is transferred through a file that is usual for Windows *.ini, the name of which is passed to the program on the command line. In this case, all the data in the file is already carefully divided into sections by the server and all you have to do is use the “GetPrivateProfile*” functions to extract them from there. The response is sent to the server again through a file whose name is indicated in the corresponding entry in the ini file.
What data can be transferred by the client to the CGI program? - almost any. In general, the program is passed the values of the form fields that the client fills out, but it can also be some kind of binary data, for example, a file with a picture or music. Data can be transferred to the server by two different methods - the GET method and the POST method. When we create a form to be filled out on our page, we explicitly indicate which of the given methods we want to send the data entered by the user, this is done in the main tag of the form something like this:
When sending data using the GET method, the browser reads the data from the form and places it after the script URL, behind a question mark; if there are several significant fields in the form, then they are all transmitted through the “&” sign, the field name and its value are written in the URL through the “” sign =". For example, a request generated by a browser from a form when you click on a button to which the script “/cgi-bin/test.exe” is attached, taking into account that the first field of the form is called “your_name”, the second – “your_age”, may look like this:
GET /cgi-bin/test.exe?your_name=Pupkin&your_age=90 HTTP/1.0
Using the GET method has several weaknesses - the first and most important is because The data is transmitted in the URL, then it has a limit on the amount of this transmitted data. The second weakness again follows from the URL - this is confidentiality, with such a transfer the data remains absolutely open. So, it’s good if we have 2-3 small fields in the form... the question arises, what to do if there is more data? The answer is to use the POST method!
When using the POST method, the data is transmitted to the server as a block of data, and not in a URL, which somewhat frees our hands to increase the amount of information transmitted; for the above example of the POST form, the block sent to the server will be something like this:
POST /cgi-bin/test.exe HTTP/1.0
Accept: text/plain
Accept: text/html
Accept: */*
Content-type: application/x-www-form-urlencoded
Content-length: 36
your_name=Pupkin&your_age=90
As mentioned above, after receiving the data, the server must convert it and pass it to the CGI program. In the standard CGI specification, client input for a GET request is placed by the server in the program's environment variable "QUERY_STRING". When a POST request is made, the data is placed on the application's standard input stream, where it can be read by it. In addition, with such a request, the server sets two more environment variables - CONTENT_LENGTH and CONTENT_TYPE, by which one can judge the length of the request in bytes and its content.
In addition to the data itself, the server also sets other environment variables of the called program; here are some of them:
REQUEST_METHOD
Describes exactly how the data was obtained
Example:REQUEST_METHOD=GET
QUERY_STRING
Query string if GET method was used
Example:QUERY_STRING= your_name=Pupkin&your_age=90&hobby=asm
CONTENT_LENGTH
Length in bytes of the request body
Example:CONTENT_LENGTH=31
CONTENT_TYPE
Request body type
GATEWAY_INTERFACE
CGI protocol version
Example:GATEWAY_INTERFACE=CGI/1.1
REMOTE_ADDR
IP address of the remote host, that is, the client who clicked the button in the form
Example:REMOTE_ADDR=10.21.23.10
REMOTE_HOST
The name of the remote host, this can be its domain name or, for example, the name of a computer in a Windows environment; if these cannot be obtained, then the field contains its IP
Example:REMOTE_HOST=wasm.ru
SCRIPT_NAME
The name of the script used in the request.
Example:SCRIPT_NAME=/cgi-bin/gols.pl
SCRIPT_FILENAME
The name of the script file on the server.
Example:SCRIPT_FILENAME=c:/page/cgi-bin/gols.pl
SERVER_SOFTWARE
Server software
Example: Apache/1.3.19 (WIN32)
The called CGI program can read any of its environment variables set by the server and use them to its advantage.
In general, this is all in brief, for more detailed information about the Common Gateway Interface, see the specialized documentation, I made this description in order to remind you, and if you didn’t know, then bring you up to date. Let's try to do something in practice.
Practical part
For practice, we will need at least 3 things - some kind of http server for Windows, I tried all the examples on Apache 1.3.19 for Windows, the server is free, you can download it from iYes, and we will need a server, not just any server, but one configured to run CGI scripts! See the documentation for how to do this for the server you are using. The second thing we need is, of course, an assembler; it is also necessary that the compiler supports the creation of WIN32 console applications, I use Tasm, but Fasm and Masm and many other *asms are perfect. And finally, the most important thing is that this desire is required.
So, I assume that the server was successfully installed and configured by you, so that in the root directory of the server documents there is an index.html file, which is perfectly displayed in the browser when you type the address 127.0.0.1. I will also take into account that somewhere in the jungle of server folders there is a “cgi-bin” folder in which scripts are allowed to run.
Let's check the server settings, and at the same time write a small script. Our script will be a regular *.bat file. I foresee questions - how? really? Yes, this is an ordinary batch file, as mentioned above, the CGI specification does not distinguish between file types, the main thing is that the server can run it, and it, in turn, has access to stdin/stdout and environment variables, a bat file, even not fully, but for an example it will suit us quite well. Let's create a file with approximately the following content:
@echo off
rem Request title
echo Content-type: text/html
echo.
rem Request body
echo "Hello!
echo "The GET request sent the following data: %QUERY_STRING%
Let's call the file test.bat and place it in the directory for running scripts, most likely it will be the “cgi-bin” directory. The next thing we need to do is call this script in some way, in principle, this can be done directly by typing something like the following “http://127.0.0.1/cgi-bin/test.bat” into the browser address window, but let’s Let's call it from our main page, and at the same time check the operation of the GET method. Let's create a file index.html in the server root with the following content:
Now, when you enter the server (http://127.0.0.1 in the browser address bar), a form should appear, type something in it and click the “send” button, if everything was done correctly, you will see the response from our bat- in the browser window script. Now let's see what we got up to there.
As you might guess, the “echo” command outputs to stdout; first of all, we pass the header of our response to the server – “echo Content-type: text/html”. This is a standard CGI specification header, indicating that we want to transfer text or an html document; there are other headers. A very important point is that the header must be separated from the response body by an empty line, which we do with the following “echo.” command. Next, the body of the response itself is transmitted - this is a regular html document, in the body of the document, for clarity, I display one of the environment variables passed to us by the server - “QUERY_STRING”, as already mentioned with the GET method (and this is exactly our case), everything is transmitted in this variable user-entered data, which we can observe in the script response. You may have noticed “the quotation marks are out of place” in the last 2 lines of the file, immediately after “echo”, they are there because of the specificity of bat files, as you can see the html tags are surrounded by the characters “<» и «>", at the same time, these symbols serve as input/output redirection in bat files, and therefore we cannot freely use them here.
I recommend playing around a little with such bat scripts, it can be very useful, try looking at other environment variables. I’ll say a little, deviating from the topic, on UNIX systems, command interpreter languages are very highly developed and the line between programming in a command interpreter language and programming in a “real” programming language is very, very blurry in some cases, so simple scripts are often written on UNIX systems specifically in command interpreter languages, but the Windows interpreter cmd.exe or, earlier, command.com are clearly weak for these purposes.
Now let's move on to the most important task of this article, to actually writing a CGI program in assembler. In principle, if we take into account all of the above about CGI, we can draw a conclusion about what the CGI interface requires from our program:
- The program must be able to read standard input (stdin) in order to access data sent by the POST method;
- The program must be able to write to the standard output stream (stdout) in order to transmit the result of its work to the server;
- From the first two points it follows that in order for the server to send something to our program in stdin, and for it to respond to it in stdout, the CGI program must be a console application;
- Our program must be able to read its environment variables.
Let's start with the last point. To gain access to the environment variables of a Windows application, the API function “GetEnvironmentStrings” is used, the function has no arguments and returns a pointer to an array of environment variables (NAME=VALUE) separated by zero, the array is closed with a double zero, when the program is launched by the server in the program environment in addition to standard variables, specific CGI variables described above are added; when you run the program from the command line, you will not see them, naturally.
In order to write something to stdout or read from stdin, we first need to get the handles of these streams, this is done using the API function “GetStdHandle”, one of the following values is passed as a function parameter:
- STD_INPUT_HANDLE - for stdin (standard input);
- STD_OUTPUT_HANDLE - for stdout (standard output);
- STD_ERROR_HANDLE - for stderr.
The function will return the handle we need for read/write operations. The next thing we need to do is write/read these streams. This is done by normal file read/write operations, i.e. ReadFile and WriteFile. There is one subtlety here, you might think that you can use WriteConsole/ReadConsole for these purposes, but this is really true for the console and will work great, the results, just like with WriteFile, will be output to the console, but this will continue until we launch our program as a script on the server. This happens because when our program is launched by the server, the handles returned by the “GetStdHandle” function will no longer be console handles as such, they will be pipe handles, which is necessary for connecting two applications.
Here is a small example of what a CGI program should look like in assembly language:
386
.model flat,stdcall
includelib import32.lib
.const
PAGE_READWRITE = 4h
MEM_COMMIT = 1000h
MEM_RESERVE = 2000h
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
Data
hStdout dd ?
hStdin dd ?
hMem dd ?
header:
db "Content-Type: text/html",13,10,13,10,0
start_html:
db" The CGI program environment looks like this:
",13,10,0
for_stdin:
db" The STDIN of the program contains:
",13,10,0
end_html:
Db "",13,10,0
nwritten dd?
toscr db 10 dup (32)
db " - File type",0
.code
_start:
Xor ebx,ebx
call GetStdHandle,STD_OUTPUT_HANDLE
mov hStdout,eax
call GetStdHandle,STD_INPUT_HANDLE
mov hStdin,eax
Call write_stdout, offset header
call write_stdout, offset start_html
Call VirtualAlloc,ebx,1000,MEM_COMMIT+MEM_RESERVE,PAGE_READWRITE
mov hMem,eax
mov edi,eax
call GetEnvironmentStringsA
mov esi,eax
next_symbol:
mov al,
or al,al
jz end_string
mov,al
next_string:
cmpsb
jmp short next_symbol
end_string:
mov ,">rb<"
add edi,3
cmp byte ptr ,0
jnz next_string
inc edi
stosb
call write_stdout, hMem
call write_stdout, offset for_stdin
Call GetFileSize,,ebx
mov edi,hMem
call ReadFile,,edi, eax,offset nwritten, ebx
add edi,
mov byte ptr ,0
call write_stdout, hMem
call write_stdout, offset end_html
call VirtualFree,hMem
call ExitProcess,-1
Write_stdout proc bufOffs:dword
call lstrlen,bufOffs
call WriteFile,,bufOffs,eax,offset nwritten,0
ret
write_stdout endp
extrn GetEnvironmentStringsA:near
extrn GetStdHandle:near
extrn ReadFile:near
extrn WriteFile:near
extrn GetFileSize:near
extrn VirtualAlloc:near
extrn VirtualFree:near
extrn ExitProcess:near
extrn lstrlen:near
ends
end_start
The executable file is built with the commands:
tasm32.exe /ml test.asm
tlink32.exe /Tpe /ap /o test.obj
Don't forget that the program must be a console program.
You can call this program using the html form described above, you just need to change the name test.bat in the form to test.exe and copy it to /cgi-bin/ accordingly, you can set it to POST in the request method, the program processes it.
I also want to note that you can call the program in another way, you can create a file in the cgi-bin directory, for example test.cgi, with one single line “#!c:/_path_/test.exe” and call it in requests, and the server in in turn, will read its first line and launch the exe file; for this, it is necessary that the *.cgi extension be specified in the http server settings as an extension for scripts. With this approach, the server will launch our program with the command line “test.exe path_to_test.exe” this has several advantages - the first is that the person running our script will not even guess what the script is written in, the second is the way it is transmitted to us the name of the file with our line, we can, for example, add any settings for our script to this file, which simplifies debugging, by the way, this is how all interpreters work - you may have noticed that in all perl/php/etc programs there is a similar line - indicating to the command interpreter itself. So, when the server starts a cgi program, if the program extension is registered as a script in the settings, it reads the first line of the file, and if it turns out to be in the format described above, then it launches the program specified in the line with the name of this file followed by a space, let’s say that in The pearl interpreter is indicated in the line; having received such a gift, it begins its execution, because The comment in Perl is the “#” symbol, then it skips the first line and the script continues to be executed, in general it’s a convenient thing.