New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 29, 2013

Conversation

Projects
None yet
2 participants
@tbonfort
Member

tbonfort commented Mar 29, 2013

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

This comment has been minimized.

Show comment
Hide comment
@sdlime

sdlime Feb 6, 2013

Member

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

Steve

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 pushed a commit to faegi/mapserver that referenced this pull request Apr 9, 2013

sebastic added a commit to sebastic/mapserver that referenced this pull request Jun 3, 2013

Handle Content-Type HTTP headers with a charset appended.
The fix for mapserver#4585 in cgiutil.c is also needed in mapows.c to handle Content-Type HTTP headers with a charset appended.

tbonfort added a commit that referenced this pull request Jun 4, 2013

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment