Hi

I can successfully send small amounts of data in response to a GET
through THttpServer but large amounts (around 10Kb) seem to contain the
first 10% of the data in the last 10% position (very approx).

I see the same effect using Chrome, Firefox and RESTClient (not checked
with IE yet).

I call SendStream() on the connection having created the full DocStream
- to allow cross domain access I manually create the header.

The data appears fine in my BCB before it is sent.

(To be honest I don't know (am struggling to assert) whether the data is
being gzip or not before it is sent.  I would like to ensure it is
gzipped and also welcome advice on how to do that.)

Any suggestions what I am doing wrong?

Paul




        String sReferer = pClientCnx->RequestReferer;
        int    n        = sReferer.Pos("://");
        int    n2       = sReferer.SubString(n + 3, 1000).Pos("/");
        if(n2)
            sReferer = sReferer.SubString(1, n2 + n + 1);

        String sResponseHeader = pClientCnx->Version +
                                 " 200 OK\r\n" +
                                 sContentType +
                                 "Pragma: no-cache\r\n"
                                 "nExpires: -1\r\n"
"Access-Control-Allow-Origin: " + sReferer + "\r\n"
                                 "Content-Length: " +
IntToStr(pmsResult->Size) +
                                 "\r\n\r\n";

        TMemoryStream * pmsToSend = new TMemoryStream;
        pmsToSend->Write(sResponseHeader.c_str(),
sResponseHeader.Length());
        pmsResult->Seek(0, 0);
        pmsToSend->Write((char *)pmsResult->Memory, pmsResult->Size);
        pmsToSend->Seek(0, 0);
        pClientCnx->DocStream = pmsToSend;
        pClientCnx->SendStream();

        // Let HTTP server component know we will send data to client
        Flags = hgWillSendMySelf;

        // We ask server component to send the stream for us.
        pClientCnx->DocStream = pmsToSend;
        pClientCnx->SendStream();





--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to