Hey,
Notfalls könnte ich auch auf Perl zurückgreifen, währe aber nicht meine Wunschlösung.
Einzeiler gefällig?
#!perl
use HTTP::Request;
print [HTTP::Request->parse(<<REQUEST)->parts]->[0]->headers->header('Content-Type');
POST /check HTTP/1.1
User-Agent: Opera/9.02 (Windows NT 5.0; U; de)
Host: validator.w3.org
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: de,en;q=0.9
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers
Content-Length: 489
Content-Type: multipart/form-data; boundary=----------zsmTCjOACDaBkeqqTrYBUx
------------zsmTCjOACDaBkeqqTrYBUx
Content-Disposition: form-data; name="uploaded_file"; filename="validate.xml"
Content-Type: text/xml; charset=UTF-8
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<title />
</head>
<body>
</body>
</html>
------------zsmTCjOACDaBkeqqTrYBUx--
REQUEST
--
水-金-地-火-木-土-天-海-冥
水-金-地-火-木-土-天-海-冥