View | Details | Raw Unified | Return to bug 54773
Collapse All | Expand All

(-)src/server.c (-4 / +42 lines)
Lines 1610-1617 serve_unchanged (char *arg) Link Here
1610
	    && strncmp (arg, name, cp - name) == 0)
1610
	    && strncmp (arg, name, cp - name) == 0)
1611
	{
1611
	{
1612
	    timefield = strchr (cp + 1, '/') + 1;
1612
	    timefield = strchr (cp + 1, '/') + 1;
1613
	    if (*timefield != '=')
1613
	    /* If the time field is not currently empty, then one of
1614
	     * serve_modified, serve_is_modified, & serve_unchanged were
1615
	     * already called for this file.  We would like to ignore the
1616
	     * reinvocation silently or, better yet, exit with an error
1617
	     * message, but we just avoid the copy-forward and overwrite the
1618
	     * value from the last invocation instead.  See the comment below
1619
	     * for more.
1620
	     */
1621
	    if (*timefield == '/')
1614
	    {
1622
	    {
1623
		/* Copy forward one character.  Space was allocated for this
1624
		 * already in serve_entry().  */
1615
		cp = timefield + strlen (timefield);
1625
		cp = timefield + strlen (timefield);
1616
		cp[1] = '\0';
1626
		cp[1] = '\0';
1617
		while (cp > timefield)
1627
		while (cp > timefield)
Lines 1619-1626 serve_unchanged (char *arg) Link Here
1619
		    *cp = cp[-1];
1629
		    *cp = cp[-1];
1620
		    --cp;
1630
		    --cp;
1621
		}
1631
		}
1622
		*timefield = '=';
1623
	    }
1632
	    }
1633
	    /* If *TIMEFIELD wasn't "/", we assume that it was because of
1634
	     * multiple calls to Is-Modified & Unchanged by the client and
1635
	     * just overwrite the value from the last call.  Technically, we
1636
	     * should probably either ignore calls after the first or send the
1637
	     * client an error, since the client/server protocol specification
1638
	     * specifies that only one call to either Is-Modified or Unchanged
1639
	     * is allowed, but broken versions of WinCVS & TortoiseCVS rely on
1640
	     * this behavior.
1641
	     */
1642
	    *timefield = '=';
1624
	    break;
1643
	    break;
1625
	}
1644
	}
1626
    }
1645
    }
Lines 1655-1662 serve_is_modified (char *arg) Link Here
1655
	    && strncmp (arg, name, cp - name) == 0)
1674
	    && strncmp (arg, name, cp - name) == 0)
1656
	{
1675
	{
1657
	    timefield = strchr (cp + 1, '/') + 1;
1676
	    timefield = strchr (cp + 1, '/') + 1;
1658
	    if (!(timefield[0] == 'M' && timefield[1] == '/'))
1677
	    /* If the time field is not currently empty, then one of
1678
	     * serve_modified, serve_is_modified, & serve_unchanged were
1679
	     * already called for this file.  We would like to ignore the
1680
	     * reinvocation silently or, better yet, exit with an error
1681
	     * message, but we just avoid the copy-forward and overwrite the
1682
	     * value from the last invocation instead.  See the comment below
1683
	     * for more.
1684
	     */
1685
	    if (*timefield == '/')
1659
	    {
1686
	    {
1687
		/* Copy forward one character.  Space was allocated for this
1688
		 * already in serve_entry().  */
1660
		cp = timefield + strlen (timefield);
1689
		cp = timefield + strlen (timefield);
1661
		cp[1] = '\0';
1690
		cp[1] = '\0';
1662
		while (cp > timefield)
1691
		while (cp > timefield)
Lines 1664-1671 serve_is_modified (char *arg) Link Here
1664
		    *cp = cp[-1];
1693
		    *cp = cp[-1];
1665
		    --cp;
1694
		    --cp;
1666
		}
1695
		}
1667
		*timefield = 'M';
1668
	    }
1696
	    }
1697
	    /* If *TIMEFIELD wasn't "/", we assume that it was because of
1698
	     * multiple calls to Is-Modified & Unchanged by the client and
1699
	     * just overwrite the value from the last call.  Technically, we
1700
	     * should probably either ignore calls after the first or send the
1701
	     * client an error, since the client/server protocol specification
1702
	     * specifies that only one call to either Is-Modified or Unchanged
1703
	     * is allowed, but broken versions of WinCVS & TortoiseCVS rely on
1704
	     * this behavior.
1705
	     */
1706
	    *timefield = 'M';
1669
	    if (kopt != NULL)
1707
	    if (kopt != NULL)
1670
	    {
1708
	    {
1671
		if (alloc_pending (strlen (name) + 80))
1709
		if (alloc_pending (strlen (name) + 80))

Return to bug 54773