Bug 31048

Summary: strnstr not available on Solaris
Product: WebKit Reporter: t.hirsch <t.hirsch>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Other   

Description t.hirsch@web.de 2009-11-03 01:15:36 PST
In the file WebCore/websockets/WebSocketHandshake.cpp in line 255 you make use of strnstr(), which is not available on Solaris. If you can avoid it, WebKit would compile on Solaris.

Here's a suggestion for a patch, but I'm not sure if strstr() really does the same thing as strnstr() was doing before.

diff --git
a/src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.cpp
b/src/3rdparty/webkit/WebCore/websockets/W
index 691fa1c..1974f68 100644
--- a/src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.cpp
+++ b/src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.cpp
@@ -252,7 +252,7 @@ int WebSocketHandshake::readServerHandshake(const
char* header, size_t len)
p += sizeof(webSocketConnectionHeader) - 1;
}
- if (!strnstr(p, "\r\n\r\n", end - p)) {
+ if (!strstr(p, "\r\n\r\n")) {
// Just hasn't been received fully yet.
return -1;
}

(this diff was taken in the WebKit version that comes in Qt)
Comment 1 Alexey Proskuryakov 2009-11-03 20:34:29 PST
This is not the right fix for the problem. We have a portable implementation of strnstr in wtf/StringExtras.h, so what needs to be done is adding Solaris to an #if guarding the implementation.

Please submit patches for review as described in <http://webkit.org/coding/contributing.html> (in this particular case, we actually already have a patch submitted, but it was overlooked, because the contributor failed to set review? flag).

*** This bug has been marked as a duplicate of bug 30647 ***