POST request Content-type headers don't accept extra args #4585

Merged
merged 1 commit into from Mar 29, 2013

Projects

None yet

3 participants

@juliensam
Contributor

When building an XHR request to MapServer with a POST method some browser will add the charet to the Content-type header parameters. This make MapServer unable to read the map parameter from the post data.

Example:

Ext.Ajax.request({
      url: mapserver,
      method: 'POST',
      params: {
        savequery: 'true',
        map: mapfile,
        mapext: extent.left +" "+ extent.bottom +" "+ extent.right +" "+ extent.top,
        mode: 'nquery',
        ....
      },
      success: function(response) {
        console.log(response)
      }
    });

This will make Firefox to send the following content-type:

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

https://github.com/mapserver/mapserver/blob/master/cgiutil.c#L162
MapServer requires the Content-Type of any POST request to be exactly
application/x-www-form-urlencoded
Using a strncmp would solve the issue.

In the mean time, the POST request will work if you pass the mapfile in the QUERY_STRING (?map=...mapfile.map).

@sdlime
Member
sdlime commented Feb 6, 2013

Julien: Your solution seems reasonable. Do you have access to patch 6.2 and the master branches?

Steve

@tbonfort tbonfort merged commit 484e28c into mapserver:branch-6-2 Mar 29, 2013

1 check failed

default Merged build finished.
Details
@mkofahl mkofahl pushed a commit to faegi/mapserver that referenced this pull request Apr 9, 2013
@tbonfort tbonfort ignore additional encodings in received content-type headers (#4585)
closes #4585
426193c
@sebastic sebastic added a commit to sebastic/mapserver that referenced this pull request Jun 3, 2013
@sebastic sebastic Handle Content-Type HTTP headers with a charset appended.
The fix for #4585 in cgiutil.c is also needed in mapows.c to handle Content-Type HTTP headers with a charset appended.
15e88c6
@tbonfort tbonfort added a commit that referenced this pull request Jun 4, 2013
@sebastic @tbonfort sebastic + tbonfort Handle Content-Type HTTP headers with a charset appended.
The fix for #4585 in cgiutil.c is also needed in mapows.c to handle Content-Type HTTP headers with a charset appended.
72a9a19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment