Skip to content
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

Unconsistent behavior between direct post and url-encoded post for Update in Corese-Server #191

Open
remiceres opened this issue Jun 25, 2024 · 0 comments

Comments

@remiceres
Copy link
Collaborator

remiceres commented Jun 25, 2024

Issue Description:

When executing an update query using Corese-Server, there is inconsistent behavior between two methods of sending SPARQL updates: direct POST and URL-encoded POST. The issue manifests in how the server responds upon successful updates:

  1. URL-encoded POST (Content-Type: application/x-www-form-urlencoded):

    • After executing the update query, the server returns an empty result set formatted according to the Accept header. This behavior occurs even when the update operation completes successfully.
  2. Direct POST (Content-Type: application/sparql-update):

    • Upon successful execution of the update query, the server returns no body (Length=0).

Bug Details:

The inconsistency in response between these two methods is problematic for applications relying on consistent behavior across different types of SPARQL update requests. The expected behavior is to have uniform responses regardless of the method used to send the update query.

Steps to Reproduce:

  1. Prepare an update query, for example:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA { <http://example/book1> dc:title "A newer book" . }
  1. Execute the update query using both methods:

    - Using URL-encoded POST:

curl -X POST \
  --url http://localhost:8080/sparql \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data "update=$QUERY"

- Using Direct POST:

curl -X POST \
  --url http://localhost:8080/sparql \
  --header "Content-Type: application/sparql-update" \
  --data "$QUERY"

Actual Behavior:

  • URL-encoded POST:

The server returns an empty result set formatted according to the Accept header, even when the update operation is successful. For example (Accept: application/sparql-results+xml):

<?xml version="1.0" ?>
<sparql
    xmlns='http://www.w3.org/2005/sparql-results#'>
    <head></head>
    <results>
        <result></result>
    </results>
</sparql>
  • Direct POST:

The server returns no body (Length=0) upon successful execution of the update query.

Expected Behavior:

The server should exhibit consistent behavior in response to successful SPARQL update operations, irrespective of whether the update query is sent via URL-encoded POST or Direct POST. The response should ideally either return an empty body or a standardized confirmation, ensuring predictable handling of successful update operations.

Additional Information:

  • Corese-Server version: 4.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant