Misleading error "Referer header required." when POSTing without a body
-----------------------------------------------------------------------

                 Key: COUCHDB-1025
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1025
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 1.0.1
         Environment: Ubuntu 10.10, Perl modules involved: LWP 5.836, JSON::Any 
1.22, JSON 2.21, JSON::XS 2.29
            Reporter: Malte S. Stretz
            Priority: Minor


This one gave me headaches.  I use the simple Perl library from 
<http://wiki.apache.org/couchdb/Getting_started_with_Perl> in combination with 
JSON::Any to push ~63000 documents to a database.  Since I later want to sync 
this data with outside changes, I calculated a hash of each document and 
generated a document /hashes which maps the hashes to document names (I know, 
not the best solution, but this should have been only a quick hack and I wanted 
to keep the hashes out of the actual documents).  After I split the bulk 
pushing into batches of 1024 to get around timeouts in LWP, uploading the data 
itself works fine.  But the /hashes document always fails with 
{"error":"bad_request","reason":"Referer header required."}.

After a lot of prodding in the wrong corners, Wireshark came to the rescue. The 
data sent and received is quoted below; there appears to be some 
problem/bug/config issue in LWP with POSTing large documents:  The 
Content-Length is set but no body is sent. This is not good. But the error 
message coming back from CouchDB is almost worse :)

POST /certif/hashes HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: localhost:5984
User-Agent: libwww-perl/5.836
Content-Type: application/json
Content-Length: 4478093

HTTP/1.1 400 Bad Request
Server: CouchDB/1.0.1 (Erlang OTP/R13B)
Date: Tue, 11 Jan 2011 16:47:57 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 60
Cache-Control: must-revalidate

{"error":"bad_request","reason":"Referer header required."}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to