hrev47591 adds 6 changesets to branch 'master' old head: 7749faf602bd12b598d72322524f7dc567f5fc5b new head: 44a4999b899a990c084a1c39e53857a8f929f0fe overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=44a4999+%5E7749faf ---------------------------------------------------------------------------- 579f956: gopher: (disabled) controls and size attributes on audio/video Currently those crash WebPositive when enabled. 111d695: gopher: Use a BStackOrHeapArray as temporary buffer And move it out of the loop, no need to construct it at each iteration anyway. e243a03: gopher: return an error on resource not found b8be186: gopher: Handle errors from Gophernicus It sends them as plain text instead of gopher directory when it doesn't find something... 80be7c9: gopher: Change 'd' type items to generic documents Gophernicus uses it for PostScript as well. 44a4999: gopher: Add TODOs [ François Revol <revol@xxxxxxx> ] ---------------------------------------------------------------------------- 1 file changed, 28 insertions(+), 8 deletions(-) src/kits/network/libnetapi/GopherRequest.cpp | 36 ++++++++++++++++++------ ############################################################################ Commit: 579f95647dcefce9a45a030d8830765b6ebcb658 URL: http://cgit.haiku-os.org/haiku/commit/?id=579f956 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 13:56:59 2014 UTC gopher: (disabled) controls and size attributes on audio/video Currently those crash WebPositive when enabled. ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index 5b82d02..b9c1392 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -621,6 +621,9 @@ BGopherRequest::_ParseInput(bool last) item << "<a href=\"" << link << "\">" "<span class=\"audio\">" << title << "</span></a>" "<audio src=\"" << link << "\" " + //TODO:Fix crash in WebPositive with these + //"controls=\"controls\" " + //"width=\"300\" height=\"50\" " "alt=\"" << title << "\"/>" "<span>[player]</span></audio>" "<br/>\n"; @@ -636,6 +639,9 @@ BGopherRequest::_ParseInput(bool last) item << "<a href=\"" << link << "\">" "<span class=\"video\">" << title << "</span></a>" "<video src=\"" << link << "\" " + //TODO:Fix crash in WebPositive with these + //"controls=\"controls\" " + //"width=\"300\" height=\"300\" " "alt=\"" << title << "\"/>" "<span>[player]</span></audio>" "<br/>\n"; ############################################################################ Commit: 111d695ac0c2f5c1a1248aa489cedac242a1f71b URL: http://cgit.haiku-os.org/haiku/commit/?id=111d695 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 17:04:13 2014 UTC gopher: Use a BStackOrHeapArray as temporary buffer And move it out of the loop, no need to construct it at each iteration anyway. ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index b9c1392..9af9820 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -19,6 +19,7 @@ #include <NodeInfo.h> #include <Path.h> #include <Socket.h> +#include <StackOrHeapArray.h> #include <String.h> #include <StringList.h> @@ -266,11 +267,11 @@ BGopherRequest::_ProtocolLoop() //ssize_t bytesReceived = 0; //ssize_t bytesTotal = 0; bool dataValidated = false; + BStackOrHeapArray<char, 4096> chunk(kGopherBufferSize); while (!fQuit && !receiveEnd) { fSocket->WaitForReadable(); - BNetBuffer chunk(kGopherBufferSize); - bytesRead = fSocket->Read(chunk.Data(), kGopherBufferSize); + bytesRead = fSocket->Read(chunk, kGopherBufferSize); if (bytesRead < 0) { readError = bytesRead; @@ -278,7 +279,7 @@ BGopherRequest::_ProtocolLoop() } else if (bytesRead == 0) receiveEnd = true; - fInputBuffer.AppendData(chunk.Data(), bytesRead); + fInputBuffer.AppendData(chunk, bytesRead); if (!dataValidated) { size_t i; ############################################################################ Commit: e243a034761a06f81c11c512712ba75240b6b019 URL: http://cgit.haiku-os.org/haiku/commit/?id=e243a03 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 17:15:16 2014 UTC gopher: return an error on resource not found ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index 9af9820..13193de 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -42,6 +42,8 @@ * gopher://jgw.mdns.org/1/MISC/ 's' item (sound) * gopher://gopher.floodgap.com/1/gopher broken link * gopher://sdf.org/1/maps/m missing lines + * gopher://sdf.org/1/foo gophernicus reports errors incorrectly + * gopher://gopher.floodgap.com/1/foo correct error report */ /** Type of Gopher items */ @@ -310,7 +312,7 @@ BGopherRequest::_ProtocolLoop() //if enough data // else continue fItemType = GOPHER_TYPE_DIRECTORY; - //readError = B_RESOURCE_NOT_FOUND; + readError = B_RESOURCE_NOT_FOUND; // continue parsing the error text anyway } } ############################################################################ Commit: b8be18672056b7e2aeec08f3ec1e29a276a44c0c URL: http://cgit.haiku-os.org/haiku/commit/?id=b8be186 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 18:26:47 2014 UTC gopher: Handle errors from Gophernicus It sends them as plain text instead of gopher directory when it doesn't find something... ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index 13193de..9f5c3b3 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -316,6 +316,16 @@ BGopherRequest::_ProtocolLoop() // continue parsing the error text anyway } } + // special case for buggy(?) Gophernicus/1.5 + static const char *buggy = "Error: File or directory not found!"; + if (fInputBuffer.Size() > strlen(buggy) + && !memcmp(fInputBuffer.Data(), buggy, strlen(buggy))) { + fItemType = GOPHER_TYPE_DIRECTORY; + readError = B_RESOURCE_NOT_FOUND; + // continue parsing the error text anyway + // but it won't look good + } + // now we probably have correct data dataValidated = true; ############################################################################ Commit: 80be7c9d8ffbc860f7607e1cb1d52bb0e8a8485a URL: http://cgit.haiku-os.org/haiku/commit/?id=80be7c9 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 19:53:51 2014 UTC gopher: Change 'd' type items to generic documents Gophernicus uses it for PostScript as well. ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index 9f5c3b3..18de5aa 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -72,7 +72,7 @@ typedef enum { GOPHER_TYPE_INFO = 'i', /**< information text */ GOPHER_TYPE_AUDIO = 's', /**< audio (wav?) */ /* not standardized, some servers use them */ - GOPHER_TYPE_PDF_ALT = 'd', /**< seems to be only for PDF files */ + GOPHER_TYPE_DOC = 'd', /**< gophernicus uses it for PS and PDF */ GOPHER_TYPE_PNG = 'p', /**< PNG image */ /* cf. gopher://namcub.accelera-labs.com/1/pics */ GOPHER_TYPE_MIME = 'M', /**< multipart/mixed MIME data */ @@ -110,7 +110,6 @@ static struct { { GOPHER_TYPE_GIF, "image/gif" }, { GOPHER_TYPE_HTML, "text/html" }, /* those are not standardized */ - { GOPHER_TYPE_PDF_ALT, "application/pdf" }, { GOPHER_TYPE_PDF, "application/pdf" }, { GOPHER_TYPE_PNG, "image/png"}, { GOPHER_TYPE_NONE, NULL } @@ -642,10 +641,10 @@ BGopherRequest::_ParseInput(bool last) "<br/>\n"; break; case GOPHER_TYPE_PDF: - case GOPHER_TYPE_PDF_ALT: + case GOPHER_TYPE_DOC: /* generic case for known-to-work items */ item << "<a href=\"" << link << "\">" - "<span class=\"other\">" << title << "</span></a>" + "<span class=\"document\">" << title << "</span></a>" "<br/>\n"; break; case GOPHER_TYPE_MOVIE: ############################################################################ Revision: hrev47591 Commit: 44a4999b899a990c084a1c39e53857a8f929f0fe URL: http://cgit.haiku-os.org/haiku/commit/?id=44a4999 Author: François Revol <revol@xxxxxxx> Date: Mon Jul 28 20:01:49 2014 UTC gopher: Add TODOs ---------------------------------------------------------------------------- diff --git a/src/kits/network/libnetapi/GopherRequest.cpp b/src/kits/network/libnetapi/GopherRequest.cpp index 18de5aa..da1342a 100644 --- a/src/kits/network/libnetapi/GopherRequest.cpp +++ b/src/kits/network/libnetapi/GopherRequest.cpp @@ -24,6 +24,8 @@ #include <StringList.h> /* + * TODO: fix for URLs without path like gopher://gophernicus.org + * TODO: fix '+' in selectors, cf. gopher://gophernicus.org/1/doc/gopher/ * TODO: add proper favicon * TODO: add proper dir and document icons * TODO: correctly eat the extraneous .\r\n at end of text files