Hello,
In version 2.5.2907 we ended up setting a field name in the metadata on a document with and invalid character (the '@').
I've got test code that successfully persists this document and it's invalid meta data into Raven. Now if you try to load that document via the IDE or via a session.Load<LogDocument>(id) call it'll fail with the exception below.
We've stopped doing that now, but it seems like an issue that saving the document is allowed in the first place with invalid metadata. The restriction is a set of seperator characters and US-ASCII on metadata headers.
Question
System.Net.WebHeaderCollection.CheckBadChars Is called on the way out, could something like that be done on the way in? (I do see that is an internal method of that class...).
Regards,
Nick Josevski
Test Code
IDocumentSession session;
var id = Guid.NewGuid();
var doc = new LogDocument
{
LogId = id
};
session.Store(doc);
var meta = session.Advanced.GetMetadataFor(doc);
session.SaveChanges();
// will fail:
session.Load<LogDocument>(id);
Exception:
"Error": "System.ArgumentException: Specified value has invalid HTTP Header characters.
Parameter name: name
at System.Net.WebHeaderCollection.CheckBadChars(String name, Boolean isHeaderValue)
at System.Net.WebHeaderCollection.SetInternal(String name, String value)
at Raven.Database.Extensions.HttpExtensions.WriteHeaders(IHttpContext context, RavenJObject headers, Etag etag)
at Raven.Database.Extensions.HttpExtensions.WriteData(IHttpContext context, Byte[] data, RavenJObject headers, Etag etag)
at Raven.Database.Server.Responders.Document.GetDocumentDirectly(IHttpContext context, String docId)
at Raven.Database.Server.Responders.Document.Respond(IHttpContext context)
at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx)
at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx)"