正在显示
1 个修改的文件
包含
0 行增加
和
104 行删除
src/server/dmap_serv2.cpp
deleted
100644 → 0
| 1 | -/* | ||
| 2 | - * Copyright 2007 Stephen Liu | ||
| 3 | - * For license terms, see the file COPYING along with this library. | ||
| 4 | - */ | ||
| 5 | - | ||
| 6 | -#include <string.h> | ||
| 7 | -#include <stdio.h> | ||
| 8 | -#include <stdlib.h> | ||
| 9 | -#include <string.h> | ||
| 10 | -#include <signal.h> | ||
| 11 | -#include <assert.h> | ||
| 12 | - | ||
| 13 | -#include <fcgi_stdio.h> | ||
| 14 | -// #include "dmpapacheserverrequest.h" | ||
| 15 | -// #include "dmpapacheserverresponse.h" | ||
| 16 | -// #include "dmpmainserver.h" | ||
| 17 | -// #include "dmpapplication.h" | ||
| 18 | - | ||
| 19 | -// void CreateEnv(CgiENV& env) | ||
| 20 | -// { | ||
| 21 | -// env.HTTP_HOST="localhost"; | ||
| 22 | -// env.HTTP_CONNECTION="keep-alive"; | ||
| 23 | -// env.HTTP_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53"; | ||
| 24 | -// env.HTTP_ACCEPT="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"; | ||
| 25 | -// env.HTTP_ACCEPT_ENCODING="gzip, deflate, br"; | ||
| 26 | -// env.HTTP_ACCEPT_LANGUAGE="zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"; | ||
| 27 | -// env.PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"; | ||
| 28 | -// env.SERVER_NAME="localhost"; | ||
| 29 | -// env.SERVER_ADDR="::1"; | ||
| 30 | -// env.SERVER_PORT="80"; | ||
| 31 | -// env.REMOTE_ADDR="::1"; | ||
| 32 | -// env.REQUEST_METHOD="GET"; | ||
| 33 | -// env.QUERY_STRING="REQUEST=GetCapabilities"; | ||
| 34 | -// env.REQUEST_URI="/DMap/Services/GDMap1/MapServer/WMTSServer"; | ||
| 35 | -// } | ||
| 36 | -// void InitCgiEnv(CgiENV& env) | ||
| 37 | -// { | ||
| 38 | -// //FCGX_GetParam("REMOTE_ADDR", ); | ||
| 39 | -// env.HTTP_HOST="localhost"; | ||
| 40 | -// env.HTTP_CONNECTION="keep-alive"; | ||
| 41 | -// env.HTTP_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36 Edg/95.0.1020.53"; | ||
| 42 | -// env.HTTP_ACCEPT="text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"; | ||
| 43 | -// env.HTTP_ACCEPT_ENCODING="gzip, deflate, br"; | ||
| 44 | -// env.HTTP_ACCEPT_LANGUAGE="zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6"; | ||
| 45 | -// env.PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"; | ||
| 46 | -// env.SERVER_NAME="localhost"; | ||
| 47 | -// env.SERVER_ADDR="::1"; | ||
| 48 | -// env.SERVER_PORT="80"; | ||
| 49 | -// env.REMOTE_ADDR="::1"; | ||
| 50 | -// env.REQUEST_METHOD="GET"; | ||
| 51 | -// env.QUERY_STRING="REQUEST=GetCapabilities"; | ||
| 52 | -// env.REQUEST_URI="/DMap/Services/GDMap1/MapServer/WMTSServer"; | ||
| 53 | -// } | ||
| 54 | - | ||
| 55 | -int main(int argc,char * argv[] ) | ||
| 56 | -{ | ||
| 57 | - // DmpApplication::Instance()->initialize(); | ||
| 58 | - // DmpMainServer dmpServer; | ||
| 59 | - extern char **environ; | ||
| 60 | - int nlen=0; | ||
| 61 | - int i; | ||
| 62 | - char *psz_content = NULL; | ||
| 63 | - char **pp_env; | ||
| 64 | - | ||
| 65 | - //setuid(geteuid()); | ||
| 66 | - // const char *display = getenv( "DISPLAY" ); | ||
| 67 | - // bool withDisplay = true; | ||
| 68 | - // if ( !display ) | ||
| 69 | - // { | ||
| 70 | - // withDisplay = false; | ||
| 71 | - | ||
| 72 | - // } | ||
| 73 | - while(FCGI_Accept()>=0) | ||
| 74 | - { | ||
| 75 | - printf("Content-type: text/html\n\n"); | ||
| 76 | - if(strcmp("GET",getenv("REQUEST_METHOD"))==0) | ||
| 77 | - { | ||
| 78 | - printf("REQUEST_METHOD=GET\n"); | ||
| 79 | - // CgiENV env; | ||
| 80 | - // CreateEnv(env); | ||
| 81 | - // DmpApacheServerRequest dmpRequest(env); | ||
| 82 | - // DmpApacheServerResponse dmpResponse; | ||
| 83 | - // dmpServer.HandleRequest(dmpRequest, dmpResponse); | ||
| 84 | - printf("REQUEST_METHOD=GET END\n"); | ||
| 85 | - } | ||
| 86 | - else | ||
| 87 | - { | ||
| 88 | - nlen=atoi(getenv("CONTENT_LENGTH")); | ||
| 89 | - psz_content=(char *)malloc(nlen+1); | ||
| 90 | - memset(psz_content,0,nlen+1); | ||
| 91 | - printf("<p>char value:</p><p>"); | ||
| 92 | - for(i=0;i<nlen;i++) | ||
| 93 | - { | ||
| 94 | - //psz_content[i]=fgetc(stdin); | ||
| 95 | - //printf("%c",psz_content[i]); | ||
| 96 | - } | ||
| 97 | - printf("</p><p>string value:%s</p>",psz_content); | ||
| 98 | - | ||
| 99 | - } | ||
| 100 | - } | ||
| 101 | - return 0; | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | - |
请
注册
或
登录
后发表评论