Bug 31048 - strnstr not available on Solaris
Summary: strnstr not available on Solaris
Status: RESOLVED DUPLICATE of bug 30647
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Other
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2009-11-03 01:15 PST by t.hirsch@web.de
Modified: 2009-11-03 20:34 PST (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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
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 ***