@@ -224,25 +224,46 @@ process_http_request(<<"DELETE">>,
224
224
end ;
225
225
226
226
process_http_request (<<" DELETE" >>,
227
- <<" /$management/exchanges/" , XNameBin /binary >>,
227
+ <<" /$management/exchanges/" , Path /binary >>,
228
228
undefined ,
229
229
[],
230
230
Vhost ,
231
231
# user {username = Username },
232
232
_ConnectionPid ) ->
233
- XName = rabbit_misc :r (Vhost , exchange , XNameBin ),
234
- ok = case rabbit_exchange :delete (XName , false , Username ) of
235
- ok ->
236
- ok ;
237
- {error , not_found } ->
238
- ok
239
- % % %% TODO return deletion failure
240
- % % {error, in_use} ->
241
- end ,
242
- Props = # 'v1_0.properties' {subject = {utf8 , <<" 204" >>}},
243
- AppProps = # 'v1_0.application_properties' {content = []},
244
- RespPayload = {map , []},
245
- {Props , AppProps , RespPayload };
233
+ case re :split (Path , <<" /" >>, [{return , binary }]) of
234
+ [XNameBin ] ->
235
+ XName = rabbit_misc :r (Vhost , exchange , XNameBin ),
236
+ ok = case rabbit_exchange :delete (XName , false , Username ) of
237
+ ok ->
238
+ ok ;
239
+ {error , not_found } ->
240
+ ok
241
+ % % %% TODO return deletion failure
242
+ % % {error, in_use} ->
243
+ end ,
244
+ Props = # 'v1_0.properties' {subject = {utf8 , <<" 204" >>}},
245
+ AppProps = # 'v1_0.application_properties' {content = []},
246
+ RespPayload = {map , []},
247
+ {Props , AppProps , RespPayload };
248
+ [XNameBin , <<" bindings" >>, SrcXNameBin , BindingKey , ArgsHash ] ->
249
+ SrcXName = rabbit_misc :r (Vhost , exchange , SrcXNameBin ),
250
+ XName = rabbit_misc :r (Vhost , exchange , XNameBin ),
251
+ Bindings0 = rabbit_binding :list_for_source_and_destination (SrcXName , XName , true ),
252
+ case lists :search (fun (# binding {key = Key ,
253
+ args = Args }) ->
254
+ Key =:= BindingKey andalso
255
+ args_hash (Args ) =:= ArgsHash
256
+ end , Bindings0 ) of
257
+ {value , Binding } ->
258
+ ok = rabbit_binding :remove (Binding , Username );
259
+ false ->
260
+ ok
261
+ end ,
262
+ Props = # 'v1_0.properties' {subject = {utf8 , <<" 204" >>}},
263
+ AppProps = # 'v1_0.application_properties' {content = []},
264
+ RespPayload = {map , []},
265
+ {Props , AppProps , RespPayload }
266
+ end ;
246
267
247
268
process_http_request (<<" GET" >>,
248
269
<<" /$management/" , Path0 /binary >>,
0 commit comments