Fossil SCM
Add new "transport_flip()" and "transport_rewind()" methods. These are no-ops for HTTP, but might be useful for FILE and maybe even HTTPS.
Commit
63ef585508a08ac847390be8506082ae098bd62e
Parent
327823e39bd363b…
2 files changed
+3
+20
+3
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -167,10 +167,11 @@ | ||
| 167 | 167 | */ |
| 168 | 168 | transport_send(&hdr); |
| 169 | 169 | transport_send(&payload); |
| 170 | 170 | blob_reset(&hdr); |
| 171 | 171 | blob_reset(&payload); |
| 172 | + transport_flip(); | |
| 172 | 173 | |
| 173 | 174 | /* |
| 174 | 175 | ** Read and interpret the server reply |
| 175 | 176 | */ |
| 176 | 177 | closeConnection = 1; |
| @@ -216,10 +217,12 @@ | ||
| 216 | 217 | /* |
| 217 | 218 | ** Close the connection to the server if appropriate. |
| 218 | 219 | */ |
| 219 | 220 | if( closeConnection ){ |
| 220 | 221 | transport_close(); |
| 222 | + }else{ | |
| 223 | + transport_rewind(); | |
| 221 | 224 | } |
| 222 | 225 | return; |
| 223 | 226 | |
| 224 | 227 | /* |
| 225 | 228 | ** Jump to here if an error is seen. |
| 226 | 229 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -167,10 +167,11 @@ | |
| 167 | */ |
| 168 | transport_send(&hdr); |
| 169 | transport_send(&payload); |
| 170 | blob_reset(&hdr); |
| 171 | blob_reset(&payload); |
| 172 | |
| 173 | /* |
| 174 | ** Read and interpret the server reply |
| 175 | */ |
| 176 | closeConnection = 1; |
| @@ -216,10 +217,12 @@ | |
| 216 | /* |
| 217 | ** Close the connection to the server if appropriate. |
| 218 | */ |
| 219 | if( closeConnection ){ |
| 220 | transport_close(); |
| 221 | } |
| 222 | return; |
| 223 | |
| 224 | /* |
| 225 | ** Jump to here if an error is seen. |
| 226 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -167,10 +167,11 @@ | |
| 167 | */ |
| 168 | transport_send(&hdr); |
| 169 | transport_send(&payload); |
| 170 | blob_reset(&hdr); |
| 171 | blob_reset(&payload); |
| 172 | transport_flip(); |
| 173 | |
| 174 | /* |
| 175 | ** Read and interpret the server reply |
| 176 | */ |
| 177 | closeConnection = 1; |
| @@ -216,10 +217,12 @@ | |
| 217 | /* |
| 218 | ** Close the connection to the server if appropriate. |
| 219 | */ |
| 220 | if( closeConnection ){ |
| 221 | transport_close(); |
| 222 | }else{ |
| 223 | transport_rewind(); |
| 224 | } |
| 225 | return; |
| 226 | |
| 227 | /* |
| 228 | ** Jump to here if an error is seen. |
| 229 |
+20
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -114,10 +114,30 @@ | ||
| 114 | 114 | if( sent<=0 ) break; |
| 115 | 115 | n -= sent; |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | + | |
| 120 | +/* | |
| 121 | +** This routine is called when the outbound message is complete and | |
| 122 | +** it is time to being recieving a reply. | |
| 123 | +*/ | |
| 124 | +void transport_flip(void){ | |
| 125 | + if( g.urlIsFile ){ | |
| 126 | + /* run "fossil http" to process the outbound message */ | |
| 127 | + } | |
| 128 | +} | |
| 129 | + | |
| 130 | +/* | |
| 131 | +** This routine is called when the inbound message has been received | |
| 132 | +** and it is time to start sending again. | |
| 133 | +*/ | |
| 134 | +void transport_rewind(void){ | |
| 135 | + if( g.urlIsFile ){ | |
| 136 | + transport_close(); | |
| 137 | + } | |
| 138 | +} | |
| 119 | 139 | |
| 120 | 140 | /* |
| 121 | 141 | ** Read N bytes of content from the wire and store in the supplied buffer. |
| 122 | 142 | ** Return the number of bytes actually received. |
| 123 | 143 | */ |
| 124 | 144 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -114,10 +114,30 @@ | |
| 114 | if( sent<=0 ) break; |
| 115 | n -= sent; |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** Read N bytes of content from the wire and store in the supplied buffer. |
| 122 | ** Return the number of bytes actually received. |
| 123 | */ |
| 124 |
| --- src/http_transport.c | |
| +++ src/http_transport.c | |
| @@ -114,10 +114,30 @@ | |
| 114 | if( sent<=0 ) break; |
| 115 | n -= sent; |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** This routine is called when the outbound message is complete and |
| 122 | ** it is time to being recieving a reply. |
| 123 | */ |
| 124 | void transport_flip(void){ |
| 125 | if( g.urlIsFile ){ |
| 126 | /* run "fossil http" to process the outbound message */ |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /* |
| 131 | ** This routine is called when the inbound message has been received |
| 132 | ** and it is time to start sending again. |
| 133 | */ |
| 134 | void transport_rewind(void){ |
| 135 | if( g.urlIsFile ){ |
| 136 | transport_close(); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | ** Read N bytes of content from the wire and store in the supplied buffer. |
| 142 | ** Return the number of bytes actually received. |
| 143 | */ |
| 144 |