Hi again,

> What do you exactly mean with "long XQuery request"? Could you provide
> us with an example that demonstrates the problem (I didn't manage to
> track it down locally)?
I'm using PHP with cURL to call the REST service (with standard username and password [admin, admin] for testing). Furthermore I'm using the BaseX HTTP Server (basexhttp.bat).
Here is some code summary (first example works well):

<?php
//...
	$query      = 'let $x := <abc>
	                           <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <aaa>Test</aaa>
				   <bb test="123"><a>test</a></bb>
				   <bb test="123"><a>test</a></bb>
				   <bb test="123"><a>test</a></bb>
				</abc> 
	               return insert node $x as last into //test';
	$fullQuery  = '<query xmlns="http://basex.org/rest">';
    $fullQuery .= '<text><![CDATA[ '.$query.']]></text>';
    $fullQuery .= '</query>';
//...
//set authorization stuff
//set Content-Type header to application/xml and send a POST request to http://localhost:8984/rest/MyDb/test.xml with $fullQuery in body.
//This works. Example XML will be inserted.
?>

But if the XML part (let $x := ...) or the XQuery part is longer I get this response 
(and I'm authorized the same way as in the first example):
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic
Content-Length: 31
Server: Jetty(6.1.26)

This example does'nt work:
<?php
	$query      = 'let $x := <abc>
	                           <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <aaa>Test</aaa>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							   <bb test="123"><a>test</a></bb>
							 </abc> 
	               return insert node $x as last into //test';
    $fullQuery  = '<query xmlns="http://basex.org/rest">';
    $fullQuery .= '<text><![CDATA[ '.$query.']]></text>';
    $fullQuery .= '</query>';
    //...
?>
Removing whitespaces makes it possible to send a request which is a bit longer, but not very much. 
Is there a solution to send requests like this, maybe in a different way? It is important to make bigger updates on my XML data with REST.

Greetings @all