Changeset 6534
- Timestamp:
- Aug 15, 2008, 8:28:43 PM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/rpc-server.c
r6533 r6534 133 133 handle_upload( struct shttpd_arg * arg ) 134 134 { 135 struct tr_rpc_server * s = arg->user_data; 135 struct tr_rpc_server * s; 136 struct ConnBuf * cbuf; 137 138 s = arg->user_data; 136 139 s->lastRequestTime = time( NULL ); 137 struct ConnBuf *cbuf = getBuffer( s, arg );140 cbuf = getBuffer( s, arg ); 138 141 139 142 /* if we haven't parsed the POST, do that now */ 140 143 if( !EVBUFFER_LENGTH( cbuf->out ) ) 141 144 { 145 const char * query_string; 146 const char * content_type; 147 const char * delim; 148 const char * in; 149 size_t inlen; 150 char * boundary; 151 size_t boundary_len; 152 char buf[64]; 153 int paused; 154 142 155 /* if we haven't finished reading the POST, read more now */ 143 156 evbuffer_add( cbuf->in, arg->in.buf, arg->in.len ); … … 146 159 return; 147 160 148 const char * query_string = shttpd_get_env( arg, "QUERY_STRING" ); 149 const char * content_type = shttpd_get_header( arg, "Content-Type" ); 150 const char * delim; 151 const char * in = (const char *) EVBUFFER_DATA( cbuf->in ); 152 size_t inlen = EVBUFFER_LENGTH( cbuf->in ); 153 char * boundary = tr_strdup_printf( "--%s", strstr( content_type, "boundary=" ) + strlen( "boundary=" ) ); 154 const size_t boundary_len = strlen( boundary ); 155 char buf[64]; 156 int paused = ( query_string != NULL ) 157 && ( shttpd_get_var( "paused", query_string, strlen( query_string ), buf, sizeof( buf ) ) == 4 ) 158 && ( !strcmp( buf, "true" ) ); 161 query_string = shttpd_get_env( arg, "QUERY_STRING" ); 162 content_type = shttpd_get_header( arg, "Content-Type" ); 163 in = (const char *) EVBUFFER_DATA( cbuf->in ); 164 inlen = EVBUFFER_LENGTH( cbuf->in ); 165 boundary = tr_strdup_printf( "--%s", strstr( content_type, "boundary=" ) + strlen( "boundary=" ) ); 166 boundary_len = strlen( boundary ); 167 paused = ( query_string != NULL ) 168 && ( shttpd_get_var( "paused", query_string, strlen( query_string ), buf, sizeof( buf ) ) == 4 ) 169 && ( !strcmp( buf, "true" ) ); 159 170 160 171 delim = tr_memmem( in, inlen, boundary, boundary_len ); … … 258 269 handle_rpc( struct shttpd_arg * arg ) 259 270 { 260 struct tr_rpc_server * s = arg->user_data; 271 struct tr_rpc_server * s; 272 struct ConnBuf * cbuf; 273 274 s = arg->user_data; 261 275 s->lastRequestTime = time( NULL ); 262 struct ConnBuf *cbuf = getBuffer( s, arg );276 cbuf = getBuffer( s, arg ); 263 277 264 278 if( !EVBUFFER_LENGTH( cbuf->out ) ) -
trunk/libtransmission/rpc-server.h
r6049 r6534 65 65 int tr_rpcIsPasswordEnabled ( const tr_rpc_server * session ); 66 66 67 /** (public for the unit tests) */ 68 char* cidrize( const char * acl ); 69 70 67 71 #endif
Note: See TracChangeset
for help on using the changeset viewer.