mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Another round of protocol changes. Backend-to-frontend messages now all
have length words. COPY OUT reimplemented per new protocol: it doesn't need \. anymore, thank goodness. COPY BINARY to/from frontend works, at least as far as the backend is concerned --- libpq's PQgetline API is not up to snuff, and will have to be replaced with something that is null-safe. libpq uses message length words for performance improvement (no cycles wasted rescanning long messages), but not yet for error recovery.
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.313 2003/04/19 00:02:29 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.314 2003/04/22 00:08:06 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -1118,7 +1118,13 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
|
||||
if (pq_getbytes((char *) &len, 4) == EOF)
|
||||
{
|
||||
elog(COMMERROR, "incomplete startup packet");
|
||||
/*
|
||||
* EOF after SSLdone probably means the client didn't like our
|
||||
* response to NEGOTIATE_SSL_CODE. That's not an error condition,
|
||||
* so don't clutter the log with a complaint.
|
||||
*/
|
||||
if (!SSLdone)
|
||||
elog(COMMERROR, "incomplete startup packet");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1133,10 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
|
||||
if (len < (int32) sizeof(ProtocolVersion) ||
|
||||
len > MAX_STARTUP_PACKET_LENGTH)
|
||||
elog(FATAL, "invalid length of startup packet");
|
||||
{
|
||||
elog(COMMERROR, "invalid length of startup packet");
|
||||
return STATUS_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate at least the size of an old-style startup packet, plus one
|
||||
@@ -1173,7 +1182,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
#endif
|
||||
if (send(port->sock, &SSLok, 1, 0) != 1)
|
||||
{
|
||||
elog(LOG, "failed to send SSL negotiation response: %m");
|
||||
elog(COMMERROR, "failed to send SSL negotiation response: %m");
|
||||
return STATUS_ERROR; /* close the connection */
|
||||
}
|
||||
|
||||
@@ -1188,6 +1197,11 @@ ProcessStartupPacket(Port *port, bool SSLdone)
|
||||
|
||||
/* Could add additional special packet types here */
|
||||
|
||||
/*
|
||||
* Set FrontendProtocol now so that elog() knows what format to send
|
||||
* if we fail during startup.
|
||||
*/
|
||||
FrontendProtocol = proto;
|
||||
|
||||
/*
|
||||
* XXX temporary for 3.0 protocol development: we are using the minor
|
||||
|
||||
Reference in New Issue
Block a user