Commit 11bb1581 authored by kocienda's avatar kocienda

WebCore:

        Reviewed by Gramps and Richard.

	Fix for this bug:

	Radar 3112233 (400 response when attaching files at mail.yahoo.com)

	KHTML multipart form code called into KMimeType class to determine
	the mime type for file attachments, however, our implementation of
	KMimeType has only stubs which call ERROR.

	I added some code into KWQKHTMLPart and WebCoreBridge so that the
	code in html_formimpl can call through to the WebFoundation mime
	file map we maintain.

        * khtml/html/html_formimpl.cpp:
        (HTMLFormElementImpl::formData)
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::mimeTypeForFileName)
        * kwq/WebCoreBridge.h:

WebKit:

         Reviewed by Gramps and Richard

         Fix for this bug:

         Radar 3112233 (400 response when attaching files at mail.yahoo.com)

         I added the MIMETypeForPath method which accesses the WebFoundation mime
         file map we maintain. KHTML can now access this map by using the bridge.

         * WebCoreSupport.subproj/WebBridge.m:
         (-[WebBridge MIMETypeForPath:])


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c2318740
2002-12-28 Ken Kocienda <kocienda@apple.com>
Reviewed by Gramps and Richard.
Fix for this bug:
Radar 3112233 (400 response when attaching files at mail.yahoo.com)
KHTML multipart form code called into KMimeType class to determine
the mime type for file attachments, however, our implementation of
KMimeType has only stubs which call ERROR.
I added some code into KWQKHTMLPart and WebCoreBridge so that the
code in html_formimpl can call through to the WebFoundation mime
file map we maintain.
* khtml/html/html_formimpl.cpp:
(HTMLFormElementImpl::formData)
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::mimeTypeForFileName)
* kwq/WebCoreBridge.h:
2002-12-26 Darin Adler <darin@apple.com>
Reviewed by Don.
......
2002-12-28 Ken Kocienda <kocienda@apple.com>
Reviewed by Gramps and Richard.
Fix for this bug:
Radar 3112233 (400 response when attaching files at mail.yahoo.com)
KHTML multipart form code called into KMimeType class to determine
the mime type for file attachments, however, our implementation of
KMimeType has only stubs which call ERROR.
I added some code into KWQKHTMLPart and WebCoreBridge so that the
code in html_formimpl can call through to the WebFoundation mime
file map we maintain.
* khtml/html/html_formimpl.cpp:
(HTMLFormElementImpl::formData)
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::mimeTypeForFileName)
* kwq/WebCoreBridge.h:
2002-12-26 Darin Adler <darin@apple.com>
Reviewed by Don.
......
......@@ -314,8 +314,14 @@ QByteArray HTMLFormElementImpl::formData(bool& ok)
if(!static_cast<HTMLInputElementImpl*>(current)->value().isEmpty())
{
hstr += "\r\nContent-Type: ";
#if APPLE_CHANGES
KWQKHTMLPart *part = KWQ(current->getDocument()->view()->part());
QString mimeType = part->mimeTypeForFileName(onlyfilename);
hstr += mimeType.ascii();
#else /* APPLE_CHANGES not defined */
KMimeType::Ptr ptr = KMimeType::findByURL(KURL(path));
hstr += ptr->name().ascii();
#endif /* APPLE_CHANGES not defined */
}
}
......
......@@ -133,6 +133,8 @@ public:
QString requestedURLString() const;
QString referrer() const;
QString userAgent() const;
QString mimeTypeForFileName(const QString &) const;
DOM::NodeImpl *selectionStart() const;
int selectionStartOffset() const;
......
......@@ -356,6 +356,13 @@ QString KWQKHTMLPart::userAgent() const
return QString();
}
QString KWQKHTMLPart::mimeTypeForFileName(const QString &fileName) const
{
NSString *ns = fileName.getNSString();
NSString *mimeType = [_bridge MIMETypeForPath:ns];
return QString::fromNSString(mimeType);
}
NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection direction)
{
DocumentImpl *doc = xmlDocImpl();
......
......@@ -251,6 +251,8 @@ enum FrameBorderStyle {
- (void)loadEmptyDocumentSynchronously;
- (NSString *)MIMETypeForPath:(NSString *)path;
@end
// This interface definition allows those who hold a WebCoreBridge * to call all the methods
......
2002-12-28 Ken Kocienda <kocienda@apple.com>
Reviewed by Gramps and Richard
Fix for this bug:
Radar 3112233 (400 response when attaching files at mail.yahoo.com)
I added the MIMETypeForPath method which accesses the WebFoundation mime
file map we maintain. KHTML can now access this map by using the bridge.
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge MIMETypeForPath:])
2002-12-28 Darin Adler <darin@apple.com>
Reviewed by Gramps and Ken
......
......@@ -41,6 +41,7 @@
#import <WebFoundation/WebResourceHandle.h>
#import <WebFoundation/WebResourceResponse.h>
#import <WebFoundation/WebSystemBits.h>
#import <WebFoundation/WebFileTypeMappings.h>
@interface NSApplication (DeclarationStolenFromAppKit)
......@@ -563,4 +564,11 @@ - (void)loadEmptyDocumentSynchronously
[url release];
}
- (NSString *)MIMETypeForPath:(NSString *)path
{
ASSERT(path);
NSString *extension = [path pathExtension];
return [[WebFileTypeMappings sharedMappings] MIMETypeForExtension:extension];
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment