| 934 | **********************************************************************/ |
| 935 | |
| 936 | int msPrepareWMSLayerRequest(int nLayerId, mapObj *map, layerObj *lp, |
| 937 | enum MS_CONNECTION_TYPE lastconnectiontype, |
| 938 | wmsParamsObj *psLastWMSParams, |
| 939 | httpRequestObj *pasReqInfo, int *numRequests) |
| 940 | { |
| 941 | #ifdef USE_WMS_LYR |
| 942 | char *pszURL = NULL, *pszHTTPCookieData = NULL; |
| 943 | const char *pszTmp; |
| 944 | rectObj bbox; |
| 945 | int bbox_width, bbox_height; |
| 946 | int nTimeout, bOkToMerge, bForceSeparateRequest, bCacheToDisk; |
| 947 | wmsParamsObj sThisWMSParams; |
| 948 | |
| 949 | char *pszProxyHost=NULL; |
| 950 | long nProxyPort=0; |
| 951 | char *pszProxyUsername=NULL, *pszProxyPassword=NULL; |
| 952 | char *pszHttpAuthUsername=NULL, *pszHttpAuthPassword=NULL; |
| 953 | enum MS_HTTP_AUTH_TYPE eHttpAuthType = MS_BASIC; |
| 954 | enum MS_HTTP_AUTH_TYPE eProxyAuthType = MS_BASIC; |
| 955 | enum MS_HTTP_PROXY_TYPE eProxyType = MS_HTTP; |
| 956 | |
| 957 | if (lp->connectiontype != MS_WMS) |
| 958 | return MS_FAILURE; |
| 959 | |
| 960 | msInitWmsParamsObj(&sThisWMSParams); |
| 961 | |
| 962 | /* ------------------------------------------------------------------ |
| 963 | * Build the request URL, this will also set layer projection and |
| 964 | * compute BBOX in that projection. |
| 965 | * ------------------------------------------------------------------ */ |
| 966 | if ( msBuildWMSLayerURL(map, lp, WMS_GETMAP, |
| 967 | 0, 0, 0, NULL, &bbox, &bbox_width, &bbox_height, |
| 968 | &sThisWMSParams) != MS_SUCCESS) |
| 969 | { |
| 970 | /* an error was already reported. */ |
| 971 | msFreeWmsParamsObj(&sThisWMSParams); |
| 972 | return MS_FAILURE; |
| 973 | } |
| 974 | |
| 975 | /* ------------------------------------------------------------------ |
| 976 | * Check if the request is empty, perhaps due to reprojection problems |
| 977 | * or wms_extents restrictions. |
| 978 | * ------------------------------------------------------------------ */ |
| 979 | if( bbox_width == 0 || bbox_height == 0 ) |
| 980 | { |
| 981 | msFreeWmsParamsObj(&sThisWMSParams); |
| 982 | return MS_SUCCESS; /* No overlap. */ |
| 983 | } |
| 984 | |
| 985 | /* ------------------------------------------------------------------ |
| 986 | * Check if layer overlaps current view window (using wms_latlonboundingbox) |
| 987 | * ------------------------------------------------------------------ */ |
| 988 | if ((pszTmp = msOWSLookupMetadata(&(lp->metadata), |
| 989 | "MO", "latlonboundingbox")) != NULL) |
| 990 | { |
| 991 | char **tokens; |
| 992 | int n; |
| 993 | rectObj ext; |
no test coverage detected