Created
September 16, 2012 23:43
-
-
Save kplaube/3734844 to your computer and use it in GitHub Desktop.
Casos de uso do CGI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName www.example.com | |
ServerAlias example.com | |
ServerAdmin webmaster@example.com | |
DocumentRoot /usr/local/www/documents | |
Alias /robots.txt /usr/local/www/documents/robots.txt | |
Alias /favicon.ico /usr/local/www/documents/favicon.ico | |
Alias /media/ /usr/local/www/documents/media/ | |
<Directory /usr/local/www/documents> | |
Order allow,deny | |
Allow from all | |
</Directory> | |
WSGIScriptAlias / /usr/local/www/wsgi-scripts/wsgi.py | |
<Directory /usr/local/www/wsgi-scripts> | |
Order allow,deny | |
Allow from all | |
</Directory> | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
printf("Content-type:text/html\n\n"); | |
printf("<html>\n"); | |
printf("<body bgcolor=\"%s\">\n", argv[1]); | |
printf("</body>"); | |
printf("</html>"); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from os import environ | |
print "Content-Type: text/html\n\n" | |
print "<html><body>Hello %s!</body></html>" % environ.get('REMOTE_ADDR') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char *argv[]) | |
{ | |
char *addr, *method, *query_string; | |
addr = getenv("REMOTE_ADDR"); | |
method = getenv("REQUEST_METHOD"); | |
query_string = getenv("QUERY_STRING"); | |
printf("Content-type:text/html\n\n"); | |
printf("Remote address: %s<br/>", addr); | |
printf("Method: %s<br/>", method); | |
printf("Query string: %s<br/>", query_string); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
def application(environ, start_response): | |
start_response('200 OK', [('Content-Type', 'text/html')]) | |
return ['<html><body>Hello %s</body></html>' % environ.get('REMOTE_ADDR')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment